rails-api/active_model_serializers — pull request #451 by plexus (2013-11-11 13:36:45+00:00)
Title: embed_in_root only returns the associated objects of a single instance

When using embed: :ids ; embed_in_root: true, and serializing multiple objects,
only the associated objects of the last object in the collection will actually
show up in the serialized data.

For example, if you serialize a collection of two posts, each containing one or
more comments, only the comments of the last post show up. The reason is a
Hash#merge wich overwrites the array rather than appending to it.

This commit fixes this by merging the collection arrays, rather than the top-level
hashes.