Convert configuration parameters to Hash for passing to FoodsoftConfig
This is required for compatibility with Rails 5.0.
This commit is contained in:
parent
6486f56b0d
commit
e606f606da
1 changed files with 9 additions and 1 deletions
|
@ -19,7 +19,7 @@ class Admin::ConfigsController < Admin::BaseController
|
||||||
ActiveRecord::Base.transaction do
|
ActiveRecord::Base.transaction do
|
||||||
# TODO support nested configuration keys
|
# TODO support nested configuration keys
|
||||||
params[:config].each do |key, val|
|
params[:config].each do |key, val|
|
||||||
FoodsoftConfig[key] = val
|
FoodsoftConfig[key] = convert_config_value val
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
flash[:notice] = I18n.t('admin.configs.update.notice')
|
flash[:notice] = I18n.t('admin.configs.update.notice')
|
||||||
|
@ -54,4 +54,12 @@ class Admin::ConfigsController < Admin::BaseController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def convert_config_value(value)
|
||||||
|
if value.is_a? ActionController::Parameters
|
||||||
|
value.transform_values{ |v| convert_config_value(v) }.to_hash
|
||||||
|
else
|
||||||
|
value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue