Skip to content

Commit e53c127

Browse files
committed
[Doc] Mention new Rails integrations
1 parent 0c25a60 commit e53c127

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

docs/rails.md

+10
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,13 @@ render json: FooResource.new(foo), only: [:id]
4444
# This is OK
4545
render json: FooResource.new(foo), status: 200
4646
```
47+
48+
### Shorthand for rendering JSON with Alba
49+
50+
Now you can render JSON with shorthand.
51+
52+
First, using `render json: serialize(target)` renders JSON for given target object. You can pass `with: SomeSerializer` option to render with `SomeSerializer` in this case. If you skip `with` option Alba tries to find the correct serialize automatically.
53+
54+
There is a shorter version: `render_serialized_json(target)`. It also accepts `with` option.
55+
56+
It's recommended to use `with` option now since it cannot automatically find correct serializers sometimes.

0 commit comments

Comments
 (0)