Update README.md

I'm a bit embarrassed to admit that it took me a while to figure out this was a possibility, so I figured maybe this change will save some other poor chaps their time and/or pride.
This commit is contained in:
David Verhasselt 2013-05-13 18:23:20 +03:00
parent 8b7e9d32d7
commit 5504293776

View File

@ -195,6 +195,18 @@ def default_serializer_options
end
```
## Disabling root globally
If you want to disable the ```root```-node for all serializers, not just when
they are used in ```respond_with```, you can set the ```root``` option for the
main class in an initializer just like with Arrays:
```ruby
ActiveSupport.on_load(:active_model_serializers) do
ActiveModel::Serializer.root = false
end
```
## Getting the old version
If you find that your project is already relying on the old rails to_json