We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 37e4f1c commit b55fc32Copy full SHA for b55fc32
docs/howto/add_top_level_links.md
@@ -3,7 +3,13 @@
3
JsonApi supports a [links object](http://jsonapi.org/format/#document-links) to be specified at top-level, that you can specify in the `render`:
4
5
```ruby
6
- render json: @posts, links: { "self": "http://example.com/api/posts" }
+ links_object = {
7
+ href: "http://example.com/api/posts",
8
+ meta: {
9
+ count: 10
10
+ }
11
12
+ render json: @posts, links: links_object
13
```
14
15
That's the result:
@@ -23,7 +29,10 @@ That's the result:
23
29
}
24
30
],
25
31
"links": {
26
- "self": "http://example.com/api/posts"
32
+ "href": "http://example.com/api/posts",
33
+ "meta": {
34
+ "count": 10
35
27
36
28
37
38
0 commit comments