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
This commit is contained in:
rgarcia
2018-03-20 08:35:20 +01:00
parent 316c0aab3e
commit 86e4a5d853

View File

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