Use correct param in controller

There were some custom routes created using the param[:id] but the
Rails routes use the param[:budget_id] by default, so the same
controller could be asked for different param keys.
This commit is contained in:
Julian Herrero
2019-01-17 10:28:22 +01:00
committed by Javi Martín
parent 998b4d9e39
commit 4bd20eebf4

View File

@@ -14,7 +14,9 @@ module Budgets
private private
def load_budget def load_budget
@budget = Budget.find_by(id: params[:budget_id]) || Budget.first @budget = Budget.find_by(slug: params[:budget_id])
@budget ||= Budget.find_by(id: params[:budget_id])
@budget ||= Budget.first
end end
def load_heading def load_heading