From 86e4a5d8539dc4d1e3adc976f3b2069d23fca7cd Mon Sep 17 00:00:00 2001 From: rgarcia Date: Tue, 20 Mar 2018 08:35:20 +0100 Subject: [PATCH] Find group inside budget We were having a problem were some groups where not updating correctly. That was because it was finding the first group with that name. However we were looking for another group with the same name from another budget Apart from the group_id, we also get the budget_id in the params for updating a group. By finding groups within that budget we get the expected behaviour --- app/controllers/admin/budget_groups_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/admin/budget_groups_controller.rb b/app/controllers/admin/budget_groups_controller.rb index c56533440..caeb3c9f3 100644 --- a/app/controllers/admin/budget_groups_controller.rb +++ b/app/controllers/admin/budget_groups_controller.rb @@ -9,7 +9,7 @@ class Admin::BudgetGroupsController < Admin::BaseController end def update - @group = Budget::Group.by_slug(params[:id]).first + @group = @budget.groups.by_slug(params[:id]).first @group.update(budget_group_params) end