rails-api/active_model_serializers — pull request #406 by mkrisher (2013-10-18 22:59:04+00:00)
Title: Merges options with duplicate keys if values are hashes

This commit adds hash merging handling for duplicate keys. If the key
values are hashes, they are merged. Previously the explicit serializer
options would overwrite the default serializer options if the keys were
duplicates. Rather than overwrite, the hash key/values are now merged.
This allows you to define some default meta information in the default
serializer and append to the meta information in the explicit serializer.

For example, say you want every serialization to contain the version of
your API: meta: { version: 1 } and you also want to append pagination
information to the meta information in the explicit serializer: meta: {
page: 2 }. Previously, the serialized return would have been: meta: { page: 2 }.
After this commit, meta will now be: meta: { version: 1, page: 2 }