mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Add note for serialization usage outside of ActionController::Base
Applicable to rails-api gem.
This commit is contained in:
parent
605408005f
commit
1d95ad889e
11
README.md
11
README.md
@ -94,6 +94,17 @@ serializer when you render the object:
|
|||||||
render json: @post, serializer: FancyPostSerializer
|
render json: @post, serializer: FancyPostSerializer
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Use serialization outside of ActionController::Base
|
||||||
|
|
||||||
|
When controller does not inherit from ActionController::Base,
|
||||||
|
include Serialization module manually:
|
||||||
|
|
||||||
|
```ruby
|
||||||
|
class ApplicationController < ActionController::API
|
||||||
|
include ActionController::Serialization
|
||||||
|
end
|
||||||
|
```
|
||||||
|
|
||||||
## Arrays
|
## Arrays
|
||||||
|
|
||||||
In your controllers, when you use `render :json` for an array of objects, AMS will
|
In your controllers, when you use `render :json` for an array of objects, AMS will
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user