fix config issue with nested hash
This commit is contained in:
parent
7a9dd4edec
commit
1c878c3c13
2 changed files with 14 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue