Load budget in stats controller
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
module Budgets
|
||||
class StatsController < ApplicationController
|
||||
|
||||
before_action :load_budget
|
||||
load_and_authorize_resource :budget
|
||||
|
||||
def show
|
||||
@@ -14,5 +15,9 @@ module Budgets
|
||||
Budget::Stats.new(@budget).generate
|
||||
end
|
||||
|
||||
def load_budget
|
||||
@budget = Budget.find_by(slug: params[:budget_id]) || Budget.find_by(id: params[:budget_id])
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user