Avoid unneeded logic

This commit is contained in:
Adrian Mugnolo and Santiago Pastorino 2013-12-17 13:14:34 -02:00 committed by Santiago Pastorino
parent 80d9fb56d2
commit 28fbb62ec4

View File

@ -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