Files
nairobi/app/controllers/budgets/groups_controller.rb
Javi Martín 6bd20ef5ff Extract concern to handle investments filters
We were defining the same filters in three different controllers. We
were also adding a method in the ApplicationController which only made
sense in the same three controllers.
2021-03-15 13:31:28 +01:00

27 lines
592 B
Ruby

module Budgets
class GroupsController < ApplicationController
include InvestmentFilters
before_action :load_budget
before_action :load_group
authorize_resource :budget
authorize_resource :group, class: "Budget::Group"
before_action :set_default_investment_filter, only: :show
has_filters investment_filters, only: [:show]
def show
end
private
def load_budget
@budget = Budget.find_by_slug_or_id! params[:budget_id]
end
def load_group
@group = @budget.groups.find_by_slug_or_id! params[:id]
end
end
end