34
35
36
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
|
# File 'app/controllers/instance_configuration_controller.rb', line 34
def update
authorize! :update, Iqvoc.config
errors = []
params[:config].each { |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
errors << t("txt.controllers.instance_configuration.invalid_value",
:key => key, :error_message => exc.message)
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
|