diff --git a/app/controllers/budgets/stats_controller.rb b/app/controllers/budgets/stats_controller.rb index 48a93c5e7..558a00865 100644 --- a/app/controllers/budgets/stats_controller.rb +++ b/app/controllers/budgets/stats_controller.rb @@ -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