37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'app/controllers/instance_configuration_controller.rb', line 37
def update
authorize! :update, Iqvoc.config
errors = []
config_params.each do |key, value|
unless Iqvoc.config.defaults.include?(key)
errors << t('txt.controllers.instance_configuration.invalid_key', key: key)
else
default_value = Iqvoc.config.defaults[key]
begin
Iqvoc.config[key] = deserialize(value, default_value)
rescue TypeError => exc
Rails.logger.error(exc)
Rails.logger.error(exc.backtrace.join("\n"))
errors << t('txt.controllers.instance_configuration.invalid_value',
key: key, error_message: exc.message)
end
end
end
if errors.none?
flash[:success] = t('txt.controllers.instance_configuration.update_success')
else
flash[:error] = t('txt.controllers.instance_configuration.update_error',
error_messages: errors.join('; '))
end
redirect_to instance_configuration_url
end
|