mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-23 06:16:50 +00:00
Avoid unneeded logic
This commit is contained in:
parent
80d9fb56d2
commit
28fbb62ec4
@ -45,8 +45,11 @@ module ActiveModel
|
||||
def embedded_in_root_associations
|
||||
@object.each_with_object({}) do |item, hash|
|
||||
serializer_for(item).embedded_in_root_associations.each_pair do |type, objects|
|
||||
hash[type] = hash.fetch(type, []).concat(objects)
|
||||
hash[type].uniq!
|
||||
if hash.has_key?(type)
|
||||
hash[type].concat(objects).uniq!
|
||||
else
|
||||
hash[type] = objects
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user