Update documentation to use ActiveSupport.on_load to disable root

This commit is contained in:
Gabe Martin-Dempesy 2012-11-30 13:47:09 -06:00
parent 3c9831dc56
commit 0e02e79af8

View File

@ -132,7 +132,9 @@ more concise json. To disable the root element for arrays, you have 3 options:
#### 1. Disable root globally for in `ArraySerializer`. In an initializer:
```ruby
ActiveModel::ArraySerializer.root = false
ActiveSupport.on_load(:active_model_serializers) do
self.root = false
end
```
#### 2. Disable root per render call in your controller: