Fix embed_in_root_key merging

This commit is contained in:
Gauthier Delacroix 2014-09-09 11:27:08 +02:00
parent 605408005f
commit a862929f81

View File

@ -51,7 +51,11 @@ module ActiveModel
next if !objects || objects.flatten.empty?
if hash.has_key?(type)
hash[type].concat(objects).uniq!
case hash[type] when Hash
hash[type].deep_merge!(objects){ |key, old, new| (Array(old) + Array(new)).uniq }
else
hash[type].concat(objects).uniq!
end
else
hash[type] = objects
end