docs/general/rendering.md in active_model_serializers-0.10.5 vs docs/general/rendering.md in active_model_serializers-0.10.6

- old
+ new

@@ -201,11 +201,11 @@ ### serializer_opts #### include -PR please :) +See [Adapters: Include Option](/docs/general/adapters.md#include-option). #### Overriding the root key Overriding the resource root only applies when using the JSON adapter. @@ -258,18 +258,32 @@ Note that by using a string and symbol, Ruby will assume the namespace is defined at the top level. #### serializer -PR please :) +Specify which serializer to use if you want to use a serializer other than the default. +For a single resource: + +```ruby +@post = Post.first +render json: @post, serializer: SpecialPostSerializer +``` + +To specify which serializer to use on individual items in a collection (i.e., an `index` action), use `each_serializer`: + +```ruby +@posts = Post.all +render json: @posts, each_serializer: SpecialPostSerializer +``` + #### scope -PR please :) +See [Serializers: Scope](/docs/general/serializers.md#scope). #### scope_name -PR please :) +See [Serializers: Scope](/docs/general/serializers.md#scope). ## Using a serializer without `render` See [Usage outside of a controller](../howto/outside_controller_use.md#serializing-before-controller-render).