Skip to content

Commit 1d95ad8

Browse files
committed
Add note for serialization usage outside of ActionController::Base
Applicable to rails-api gem.
1 parent 6054080 commit 1d95ad8

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,17 @@ serializer when you render the object:
9494
render json: @post, serializer: FancyPostSerializer
9595
```
9696

97+
### Use serialization outside of ActionController::Base
98+
99+
When controller does not inherit from ActionController::Base,
100+
include Serialization module manually:
101+
102+
```ruby
103+
class ApplicationController < ActionController::API
104+
include ActionController::Serialization
105+
end
106+
```
107+
97108
## Arrays
98109

99110
In your controllers, when you use `render :json` for an array of objects, AMS will

0 commit comments

Comments
 (0)