mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-22 22:06:50 +00:00
improve doc as suggested by @bf4
This commit is contained in:
parent
37e4f1c30c
commit
b55fc32ba2
@ -3,7 +3,13 @@
|
||||
JsonApi supports a [links object](http://jsonapi.org/format/#document-links) to be specified at top-level, that you can specify in the `render`:
|
||||
|
||||
```ruby
|
||||
render json: @posts, links: { "self": "http://example.com/api/posts" }
|
||||
links_object = {
|
||||
href: "http://example.com/api/posts",
|
||||
meta: {
|
||||
count: 10
|
||||
}
|
||||
}
|
||||
render json: @posts, links: links_object
|
||||
```
|
||||
|
||||
That's the result:
|
||||
@ -23,7 +29,10 @@ That's the result:
|
||||
}
|
||||
],
|
||||
"links": {
|
||||
"self": "http://example.com/api/posts"
|
||||
"href": "http://example.com/api/posts",
|
||||
"meta": {
|
||||
"count": 10
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Loading…
Reference in New Issue
Block a user