mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-23 06:16:50 +00:00
Fix root initializer documentation
Removed the on load stuff since there is no autoloading in AMS anymore.
This commit is contained in:
parent
74d19e7d76
commit
dcc4f27f63
10
README.md
10
README.md
@ -161,13 +161,11 @@ You have 4 options to disable the root element, each with a slightly different s
|
|||||||
In an initializer:
|
In an initializer:
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
ActiveSupport.on_load(:active_model_serializers) do
|
# Disable for all serializers (except ArraySerializer)
|
||||||
# Disable for all serializers (except ArraySerializer)
|
ActiveModel::Serializer.root = false
|
||||||
ActiveModel::Serializer.root = false
|
|
||||||
|
|
||||||
# Disable for ArraySerializer
|
# Disable for ArraySerializer
|
||||||
ActiveModel::ArraySerializer.root = false
|
ActiveModel::ArraySerializer.root = false
|
||||||
end
|
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 2. Disable root per render call in your controller
|
#### 2. Disable root per render call in your controller
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user