13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'app/controllers/decidim/demographics/admin/settings_controller.rb', line 13
def update
enforce_permission_to(:update, :demographics)
@form = form(Admin::DemographicsSettingsForm).from_params(params)
Admin::UpdateDemographicsSettings.call(@form) do
on(:ok) do
flash[:notice] = I18n.t("update.success", scope: "decidim.demographics.admin.settings")
redirect_to decidim_admin_demographics.settings_path
end
on(:invalid) do
flash.now[:alert] = I18n.t("update.invalid", scope: "decidim.demographics.admin.settings")
render action: "edit", status: :unprocessable_content
end
end
end
|