You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -12,7 +12,7 @@ AMS does this through two components: **serializers** and **adapters**.
12
12
Serializers describe _which_ attributes and relationships should be serialized.
13
13
Adapters describe _how_ attributes and relationships should be serialized.
14
14
15
-
By default AMS will use the **Flatten Json Adapter**. But we strongly advise you to use **JsonApi Adapter** that follows 1.0 of the format specified in [jsonapi.org/format](http://jsonapi.org/format).
15
+
By default AMS will use the **Attributes Adapter**. But we strongly advise you to use **JsonApi Adapter** that follows 1.0 of the format specified in [jsonapi.org/format](http://jsonapi.org/format).
16
16
Check how to change the adapter in the sections bellow.
`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`.
139
+
`meta` will only be included in your response if you are using an Adapter that supports `root`,
140
+
as JsonAPI and Json adapters, the default adapter (Attributes) doesn't have `root`.
140
141
141
142
### Using a serializer without `render`
142
143
@@ -189,7 +190,7 @@ end
189
190
190
191
### Built in Adapters
191
192
192
-
#### FlattenJSON
193
+
#### Attributes
193
194
194
195
It's the default adapter, it generates a json response without a root key.
195
196
Doesn't follow any specifc convention.
@@ -199,7 +200,7 @@ Doesn't follow any specifc convention.
199
200
It also generates a json response but always with a root key. The root key **can't be overridden**, and will be automatically defined accordingly with the objects being serialized.
200
201
Doesn't follow any specifc convention.
201
202
202
-
#### JSONAPI
203
+
#### JSON API
203
204
204
205
This adapter follows 1.0 of the format specified in
205
206
[jsonapi.org/format](http://jsonapi.org/format). It will include the associated
@@ -285,9 +286,15 @@ And you can change the JSON key that the serializer should use for a particular
285
286
286
287
## Pagination
287
288
288
-
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.
289
+
Pagination links will be included in your response automatically as long
290
+
as the resource is paginated using [Kaminari](https://github.com/amatsuda/kaminari) or
291
+
[WillPaginate](https://github.com/mislav/will_paginate) and
292
+
if you are using the ```JsonApi``` adapter.
289
293
290
-
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)
294
+
Although the others adapters does not have this feature, it is possible to
295
+
implement pagination links to `JSON` adapter. For more information about it,
Copy file name to clipboardExpand all lines: docs/general/adapters.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,11 +3,11 @@
3
3
AMS does this through two components: **serializers** and **adapters**.
4
4
Serializers describe _which_ attributes and relationships should be serialized.
5
5
Adapters describe _how_ attributes and relationships should be serialized.
6
-
You can use one of the built-in adapters (```FlattenJSON``` is the default one) or create one by yourself, but you won't need to implement an adapter unless you wish to use a new format or media type with AMS.
6
+
You can use one of the built-in adapters (```Attributes``` is the default one) or create one by yourself, but you won't need to implement an adapter unless you wish to use a new format or media type with AMS.
7
7
8
8
## Built in Adapters
9
9
10
-
### FlattenJSON - Default
10
+
### Attributes - Default
11
11
12
12
It's the default adapter, it generates a json response without a root key.
13
13
Doesn't follow any specifc convention.
@@ -17,7 +17,7 @@ Doesn't follow any specifc convention.
17
17
It also generates a json response but always with a root key. The root key **can't be overridden**, and will be automatically defined accordingly to the objects being serialized.
18
18
Doesn't follow any specifc convention.
19
19
20
-
### JSONAPI
20
+
### JSON API
21
21
22
22
This adapter follows **version 1.0** of the format specified in
23
23
[jsonapi.org/format](http://jsonapi.org/format). It will include the associated
Copy file name to clipboardExpand all lines: docs/howto/add_pagination_links.md
+7-4Lines changed: 7 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,15 @@
1
1
# How to add pagination links
2
2
3
-
### JSON-API adapter
3
+
### JSONAPI adapter
4
4
5
-
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.
5
+
Pagination links will be included in your response automatically as long as
6
+
the resource is paginated and if you are using the ```JsonApi``` adapter.
6
7
7
-
If you want pagination links in your response, use [Kaminari](https://github.com/amatsuda/kaminari) or [WillPaginate](https://github.com/mislav/will_paginate).
8
+
If you want pagination links in your response, use [Kaminari](https://github.com/amatsuda/kaminari)
9
+
or [WillPaginate](https://github.com/mislav/will_paginate).
Copy file name to clipboardExpand all lines: docs/howto/add_root_key.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# How to add root key
2
2
3
-
Add the root key to your API is quite simple with AMS. The **Adapter** is what determines the format of your JSON response. The default adapter is the ```FlattenJSON``` which doesn't have the root key, so your response is something similar to:
3
+
Add the root key to your API is quite simple with AMS. The **Adapter** is what determines the format of your JSON response. The default adapter is the ```Attributes``` which doesn't have the root key, so your response is something similar to:
0 commit comments