mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-24 14:56:50 +00:00
Merge pull request #172 from vladson/patch-1
Added description of default_serializer_options to README.md. Fixes #168
This commit is contained in:
commit
49cca10592
13
README.md
13
README.md
@ -177,6 +177,19 @@ To specify a custom serializer for the items within an array:
|
|||||||
```ruby
|
```ruby
|
||||||
render :json => @posts, :each_serializer => FancyPostSerializer
|
render :json => @posts, :each_serializer => FancyPostSerializer
|
||||||
```
|
```
|
||||||
|
#### 4. Define default_serializer_options in your controller
|
||||||
|
|
||||||
|
If you define `default_serializer_options` method in your controller,
|
||||||
|
all serializers in actions of this controller and it's children will use them.
|
||||||
|
One of options may be `root: false`
|
||||||
|
|
||||||
|
```ruby
|
||||||
|
def default_serializer_options
|
||||||
|
{
|
||||||
|
root: false
|
||||||
|
}
|
||||||
|
end
|
||||||
|
```
|
||||||
|
|
||||||
## Getting the old version
|
## Getting the old version
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user