mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-23 06:16:50 +00:00
Fix embed_in_root_key merging
This commit is contained in:
parent
605408005f
commit
a862929f81
@ -51,7 +51,11 @@ module ActiveModel
|
|||||||
next if !objects || objects.flatten.empty?
|
next if !objects || objects.flatten.empty?
|
||||||
|
|
||||||
if hash.has_key?(type)
|
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
|
else
|
||||||
hash[type] = objects
|
hash[type] = objects
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user