mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 15:23:06 +00:00
Fix embed_in_root_key merging
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user