mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
add feature to include pagination links in response
This commit is contained in:
12
README.md
12
README.md
@@ -273,6 +273,18 @@ And you can change the JSON key that the serializer should use for a particular
|
||||
The `url` declaration describes which named routes to use while generating URLs
|
||||
for your JSON. Not every adapter will require URLs.
|
||||
|
||||
## Pagination
|
||||
|
||||
If you want pagination links in your response, specify it in the `render`
|
||||
|
||||
```ruby
|
||||
render json: @posts, pagination: true
|
||||
```
|
||||
|
||||
AMS relies on either Kaminari or WillPaginate. Please install either dependency by adding one of those to your Gemfile.
|
||||
|
||||
Pagination links will only be included in your response if you are using an Adapter that supports `root`, as JsonAPI and Json adapters, the default adapter (FlattenJson) doesn't have `root`.
|
||||
|
||||
## Caching
|
||||
|
||||
To cache a serializer, call ```cache``` and pass its options.
|
||||
|
||||
Reference in New Issue
Block a user