Removes use of slugs to edit group name

Changing a group’s `to_param` to return the slug instead of the id,
breaks many tests in the user facing interface

We should use slugs in upstream soon, but it should be done in a
separate PR, bringing the whole slug implementation from Madrid’s fork
and the corresponding test coverage
This commit is contained in:
rgarcia
2018-03-22 20:06:53 +01:00
parent c908e91f00
commit 7a980d79e7
2 changed files with 6 additions and 21 deletions

View File

@@ -3,13 +3,14 @@ class Admin::BudgetGroupsController < Admin::BaseController
feature_flag :budgets
def create
@budget = Budget.find params[:budget_id]
@budget = Budget.find(params[:budget_id])
@budget.groups.create(budget_group_params)
@groups = @budget.groups.includes(:headings)
end
def update
@group = @budget.groups.by_slug(params[:id]).first
@budget = Budget.find(params[:budget_id])
@group = @budget.groups.find(params[:id])
@group.update(budget_group_params)
end
@@ -19,8 +20,4 @@ class Admin::BudgetGroupsController < Admin::BaseController
params.require(:budget_group).permit(:name)
end
def load_budget
@budget = Budget.find_by(slug: params[:budget_id]) || Budget.find_by(id: params[:budget_id])
end
end