fix config issue with nested hash

This commit is contained in:
wvengen 2014-09-02 16:19:08 +02:00
parent 7a9dd4edec
commit 1c878c3c13
2 changed files with 14 additions and 1 deletions

View file

@ -249,7 +249,9 @@ class FoodsoftConfig
# Normalize value recursively (which can be entered as strings, but we want to store it properly)
def normalize_value(value)
value = value.map(&:normalize_value) if value.is_a? Array
value = Hash[ value.to_a.map{|a| [a[0], normalize_value(a[1])]} ] if value.is_a? Hash
if value.is_a? Hash
value = ActiveSupport::HashWithIndifferentAccess[ value.to_a.map{|a| [a[0], normalize_value(a[1])]} ]
end
case value
when 'true' then true
when 'false' then false