mirror of
https://github.com/internetee/registry.git
synced 2025-05-18 18:29:40 +02:00
Story#107192666 - validation for settings that DS data allowed and Allow key data cannot be both true
This commit is contained in:
parent
e01599fb1a
commit
e31087bf60
3 changed files with 26 additions and 6 deletions
|
@ -7,12 +7,18 @@ class Admin::SettingsController < AdminController
|
|||
end
|
||||
|
||||
def create
|
||||
casted_settings.each do |k, v|
|
||||
Setting[k] = v
|
||||
end
|
||||
@errors = Setting.params_errors(casted_settings)
|
||||
if @errors.empty?
|
||||
casted_settings.each do |k, v|
|
||||
Setting[k] = v
|
||||
end
|
||||
|
||||
flash[:notice] = I18n.t('records_updated')
|
||||
redirect_to [:admin, :settings]
|
||||
flash[:notice] = I18n.t('records_updated')
|
||||
redirect_to [:admin, :settings]
|
||||
else
|
||||
flash[:alert] = @errors.values.uniq.join(", ")
|
||||
render "admin/settings/index"
|
||||
end
|
||||
end
|
||||
|
||||
def show; end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue