Don't concat to nil objects

This commit is contained in:
Santiago Pastorino
2014-01-09 15:35:29 -02:00
parent df481b2b35
commit 3e510c829b
2 changed files with 37 additions and 1 deletions

View File

@@ -46,7 +46,7 @@ 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|
if hash.has_key?(type)
if hash[type]
hash[type].concat(objects).uniq!
else
hash[type] = objects