Added description of default_serializer_options

In example it's used to set up root: false for controller
This commit is contained in:
Vladislav 2012-12-15 01:35:52 +04:00
parent 6780cd3df5
commit fde724e210

View File

@ -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