Fix issue with embedding multiple associations under the same root key

This commit is contained in:
Anthony Dmitriyev
2015-03-13 13:55:38 +00:00
parent 55210ab61f
commit d62463de15
3 changed files with 24 additions and 1 deletions

View File

@@ -204,7 +204,9 @@ end
association_serializer = build_serializer(association)
# we must do this always because even if the current association is not
# embeded in root, it might have its own associations that are embeded in root
hash.merge!(association_serializer.embedded_in_root_associations) {|key, oldval, newval| [newval, oldval].flatten }
hash.merge!(association_serializer.embedded_in_root_associations) do |key, oldval, newval|
oldval.merge(newval) { |_, oldval, newval| [oldval, newval].flatten.uniq }
end
if association.embed_in_root?
if association.embed_in_root_key?