mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-23 06:16:50 +00:00
Merge pull request #642 from AlexParamonov/patch-1
Add note for serialization usage outside of ActionController::Base
This commit is contained in:
commit
40d53aaa16
11
README.md
11
README.md
@ -94,6 +94,17 @@ serializer when you render the object:
|
||||
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
|
||||
|
||||
In your controllers, when you use `render :json` for an array of objects, AMS will
|
||||
|
||||
Loading…
Reference in New Issue
Block a user