From 4bd20eebf4f9e232ef1e55fc85ce1ffb9bcbb90b Mon Sep 17 00:00:00 2001 From: Julian Herrero Date: Thu, 17 Jan 2019 10:28:22 +0100 Subject: [PATCH] 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. --- app/controllers/budgets/results_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/budgets/results_controller.rb b/app/controllers/budgets/results_controller.rb index e44a38cd9..36868b07c 100644 --- a/app/controllers/budgets/results_controller.rb +++ b/app/controllers/budgets/results_controller.rb @@ -14,7 +14,9 @@ module Budgets private 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 def load_heading