Allow for the implicit use of ArraySerializer when :each_serializer is specified.

This commit is contained in:
Mike A. Owens
2014-11-07 09:39:36 -05:00
parent c84430cdad
commit 58b6c4a6b7
3 changed files with 38 additions and 6 deletions

View File

@@ -107,7 +107,12 @@ If you wish to use a serializer other than the default, you can explicitly pass
#### 2. For an array resource:
```ruby
render json: @posts, serializer: PaginatedSerializer, each_serializer: PostPreviewSerializer
# Use the default `ArraySerializer`, which will use `each_serializer` to
# serialize each element
render json: @posts, each_serializer: PostPreviewSerializer
# Or, you can explicitly provide the collection serializer as well
render json: @posts, serializer: PaginatedSerializer, each_serializer: PostPreviewSerializer
```
## Installation