mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-22 22:06:50 +00:00
Added description of default_serializer_options
In example it's used to set up root: false for controller
This commit is contained in:
parent
6780cd3df5
commit
fde724e210
12
README.md
12
README.md
@ -169,6 +169,18 @@ To specify a custom serializer for the items within an array:
|
||||
```ruby
|
||||
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 shildren will use them.
|
||||
One of options may be `root: false`
|
||||
|
||||
```ruby
|
||||
def default_serializer_options
|
||||
{
|
||||
root: false
|
||||
}
|
||||
end
|
||||
```
|
||||
|
||||
## Getting the old version
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user