mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-23 06:16:50 +00:00
Consistently refer to the 'JSON API' and the 'JsonApi' adapter
This commit is contained in:
parent
ee40e9fcef
commit
0091be89f8
@ -11,4 +11,4 @@
|
|||||||
* remove root key option and split JSON adapter [@joaomdmoura]
|
* remove root key option and split JSON adapter [@joaomdmoura]
|
||||||
* adds FlattenJSON as default adapter [@joaomdmoura]
|
* adds FlattenJSON as default adapter [@joaomdmoura]
|
||||||
* adds support for `pagination links` at top level of JsonApi adapter [@bacarini]
|
* adds support for `pagination links` at top level of JsonApi adapter [@bacarini]
|
||||||
* adds extended format for `include` option to JSONAPI adapter [@beauby]
|
* adds extended format for `include` option to JsonApi adapter [@beauby]
|
||||||
|
|||||||
13
README.md
13
README.md
@ -136,7 +136,8 @@ The key can be customized using `meta_key` option.
|
|||||||
render json: @post, meta: { total: 10 }, meta_key: "custom_meta"
|
render json: @post, meta: { total: 10 }, meta_key: "custom_meta"
|
||||||
```
|
```
|
||||||
|
|
||||||
`meta` 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`.
|
`meta` 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`.
|
||||||
|
|
||||||
### Using a serializer without `render`
|
### Using a serializer without `render`
|
||||||
|
|
||||||
@ -285,9 +286,15 @@ And you can change the JSON key that the serializer should use for a particular
|
|||||||
|
|
||||||
## Pagination
|
## Pagination
|
||||||
|
|
||||||
Pagination links will be included in your response automatically as long as the resource is paginated using [Kaminari](https://github.com/amatsuda/kaminari) or [WillPaginate](https://github.com/mislav/will_paginate) and if you are using a ```JSON-API``` adapter.
|
Pagination links will be included in your response automatically as long
|
||||||
|
as the resource is paginated using [Kaminari](https://github.com/amatsuda/kaminari) or
|
||||||
|
[WillPaginate](https://github.com/mislav/will_paginate) and
|
||||||
|
if you are using the ```JsonApi``` adapter.
|
||||||
|
|
||||||
Although the others adapters does not have this feature, it is possible to implement pagination links to `JSON` adapter. For more information about it, please see in our docs [How to add pagination links](https://github.com/rails-api/active_model_serializers/blob/master/docs/howto/add_pagination_links.md)
|
Although the others adapters does not have this feature, it is possible to
|
||||||
|
implement pagination links to `JSON` adapter. For more information about it,
|
||||||
|
please see in our docs [How to add pagination
|
||||||
|
links](https://github.com/rails-api/active_model_serializers/blob/master/docs/howto/add_pagination_links.md).
|
||||||
|
|
||||||
## Caching
|
## Caching
|
||||||
|
|
||||||
|
|||||||
@ -1,12 +1,15 @@
|
|||||||
# How to add pagination links
|
# How to add pagination links
|
||||||
|
|
||||||
### JSON-API adapter
|
### JSON API adapter
|
||||||
|
|
||||||
Pagination links will be included in your response automatically as long as the resource is paginated and if you are using a ```JSON-API``` adapter.
|
Pagination links will be included in your response automatically as long as
|
||||||
|
the resource is paginated and if you are using the ```JsonApi``` adapter.
|
||||||
|
|
||||||
If you want pagination links in your response, use [Kaminari](https://github.com/amatsuda/kaminari) or [WillPaginate](https://github.com/mislav/will_paginate).
|
If you want pagination links in your response, use [Kaminari](https://github.com/amatsuda/kaminari)
|
||||||
|
or [WillPaginate](https://github.com/mislav/will_paginate).
|
||||||
|
|
||||||
###### Kaminari examples
|
###### Kaminari examples
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
#array
|
#array
|
||||||
@posts = Kaminari.paginate_array([1, 2, 3]).page(3).per(1)
|
@posts = Kaminari.paginate_array([1, 2, 3]).page(3).per(1)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user