Merge pull request #451 from plexus/embed_in_root_merge

embed_in_root only returns the associated objects of a single instance
This commit is contained in:
Santiago Pastorino
2013-12-16 10:39:53 -08:00
3 changed files with 51 additions and 1 deletions

View File

@@ -44,7 +44,10 @@ module ActiveModel
def embedded_in_root_associations
@object.each_with_object({}) do |item, hash|
hash.merge!(serializer_for(item).embedded_in_root_associations)
serializer_for(item).embedded_in_root_associations.each_pair do |type, objects|
hash[type] = hash.fetch(type, []).concat(objects)
hash[type].uniq!
end
end
end
end