mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-22 22:06:50 +00:00
Merge pull request #647 from gauthier-delacroix/Fix-embed_in_root_key-merging
Fix embed_in_root_key merging
This commit is contained in:
commit
ff01ba2ced
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user