Skip to content

Commit

Permalink
improve doc as suggested by @bf4
Browse files Browse the repository at this point in the history
  • Loading branch information
leandrocp committed Feb 3, 2016
1 parent 37e4f1c commit b55fc32
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions docs/howto/add_top_level_links.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -23,7 +29,10 @@ That's the result:
}
],
"links": {
"self": "http://example.com/api/posts"
"href": "http://example.com/api/posts",
"meta": {
"count": 10
}
}
}
```
Expand Down

0 comments on commit b55fc32

Please sign in to comment.