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
24 lines
523 B
Ruby
24 lines
523 B
Ruby
class Admin::BudgetGroupsController < Admin::BaseController
|
|
include FeatureFlags
|
|
feature_flag :budgets
|
|
|
|
def create
|
|
@budget = Budget.find(params[:budget_id])
|
|
@budget.groups.create(budget_group_params)
|
|
@groups = @budget.groups.includes(:headings)
|
|
end
|
|
|
|
def update
|
|
@budget = Budget.find(params[:budget_id])
|
|
@group = @budget.groups.find(params[:id])
|
|
@group.update(budget_group_params)
|
|
end
|
|
|
|
private
|
|
|
|
def budget_group_params
|
|
params.require(:budget_group).permit(:name)
|
|
end
|
|
|
|
end
|