24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'app/controllers/admin/configuration_controller.rb', line 24
def update
if params[:trusty_config]
begin
TrustyCms.config.transaction do
params[:trusty_config].each_pair do |key, value|
@trusty_config[key] = TrustyCms::Config.find_or_initialize_by(key: key)
@trusty_config[key].value = value end
redirect_to :action => :show
end
rescue ActiveRecord::RecordInvalid => e
flash[:error] = "Configuration error: please check the form"
render :action => :edit
rescue TrustyCms::Config::ConfigError => e
flash[:error] = "Configuration error: #{e}"
render :action => :edit
end
end
end
|