Remove redundant calls to load resources

This commit is contained in:
taitus
2020-07-28 13:19:48 +02:00
parent 792ebdb175
commit 46d17e8aa7
5 changed files with 6 additions and 6 deletions

View File

@@ -2,7 +2,7 @@ module Budgets
class ExecutionsController < ApplicationController class ExecutionsController < ApplicationController
before_action :load_budget before_action :load_budget
load_and_authorize_resource :budget authorize_resource :budget
def show def show
authorize! :read_executions, @budget authorize! :read_executions, @budget

View File

@@ -2,8 +2,8 @@ module Budgets
class GroupsController < ApplicationController class GroupsController < ApplicationController
before_action :load_budget before_action :load_budget
before_action :load_group before_action :load_group
load_and_authorize_resource :budget authorize_resource :budget
load_and_authorize_resource :group, class: "Budget::Group" authorize_resource :group, class: "Budget::Group"
before_action :set_default_budget_filter, only: :show before_action :set_default_budget_filter, only: :show
has_filters %w[not_unfeasible feasible unfeasible unselected selected winners], only: [:show] has_filters %w[not_unfeasible feasible unfeasible unselected selected winners], only: [:show]

View File

@@ -12,7 +12,7 @@ module Budgets
before_action :authenticate_user!, except: [:index, :show, :json_data] before_action :authenticate_user!, except: [:index, :show, :json_data]
before_action :load_budget, except: :json_data before_action :load_budget, except: :json_data
load_and_authorize_resource :budget, except: :json_data authorize_resource :budget, except: :json_data
load_and_authorize_resource :investment, through: :budget, class: "Budget::Investment", load_and_authorize_resource :investment, through: :budget, class: "Budget::Investment",
except: :json_data except: :json_data

View File

@@ -3,7 +3,7 @@ module Budgets
before_action :load_budget before_action :load_budget
before_action :load_heading before_action :load_heading
load_and_authorize_resource :budget authorize_resource :budget
def show def show
authorize! :read_results, @budget authorize! :read_results, @budget

View File

@@ -1,7 +1,7 @@
module Budgets module Budgets
class StatsController < ApplicationController class StatsController < ApplicationController
before_action :load_budget before_action :load_budget
load_and_authorize_resource :budget authorize_resource :budget
def show def show
authorize! :read_stats, @budget authorize! :read_stats, @budget