Load budget in stats controller

This commit is contained in:
rgarcia
2017-06-30 21:41:47 +02:00
committed by Javi Martín
parent 6c214c266f
commit 51ab4a430e

View File

@@ -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