class ActiveModel::Serializer
def embed(type, options={})
embed :ids, :include => true # Embed the association ids and include objects in the root
embed :ids # Embed only the association ids
embed :objects # Embed associations as full objects
Define how associations should be embedded.
def embed(type, options={}) self._embed = type self._root_embed = true if options[:include] end