Skip to content

Commit 63436c7

Browse files
author
João M. D. Moura
committed
minor updates and TYPOs
1 parent 456f915 commit 63436c7

File tree

3 files changed

+13
-19
lines changed

3 files changed

+13
-19
lines changed

docs/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Docs - ActiveModel::Serializer 0.10.x
22

3-
This is the documentation of AMS, it's focused on **0.10.x version.**
3+
This is the documentation of AMS, it's focused on the **0.10.x version.**
44

55
-----
66

@@ -11,7 +11,7 @@ This is the documentation of AMS, it's focused on **0.10.x version.**
1111

1212
## How to
1313

14-
- [How to use add root key](howto/add_root_key.md)
14+
- [How to add root key](howto/add_root_key.md)
1515

1616
## Getting Help
1717

docs/general/adapters.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
AMS does this through two components: **serializers** and **adapters**.
44
Serializers describe _which_ attributes and relationships should be serialized.
55
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 your one but you won't need to implement an adapter unless you wish to use a new format or
7-
media type with AMS.
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.
87

98
## Built in Adapters
109

@@ -15,12 +14,12 @@ Doesn't follow any specifc convention.
1514

1615
### JSON
1716

18-
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.
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.
1918
Doesn't follow any specifc convention.
2019

2120
### JSONAPI
2221

23-
This adapter follows 1.0 of the format specified in
22+
This adapter follows **version 1.0** of the format specified in
2423
[jsonapi.org/format](http://jsonapi.org/format). It will include the associated
2524
resources in the `"included"` member when the resource names are included in the
2625
`include` option.
@@ -31,9 +30,9 @@ resources in the `"included"` member when the resource names are included in the
3130
render @posts, include: 'authors,comments'
3231
```
3332

34-
## Choose an Adapter
33+
## Choosing an adapter
3534

36-
If you want to use a different adapter, such as a JsonApi, you can change this in an initializer:
35+
If you want to use a different adapter, such as JsonApi, you can change this in an initializer:
3736

3837
```ruby
3938
ActiveModel::Serializer.config.adapter = ActiveModel::Serializer::Adapter::JsonApi
@@ -45,7 +44,7 @@ or
4544
ActiveModel::Serializer.config.adapter = :json_api
4645
```
4746

48-
If you want to have a root key on your responses you should use the Json adapter, instead of the default FlattenJson:
47+
If you want to have a root key in your responses you should use the Json adapter, instead of the default FlattenJson:
4948

5049
```ruby
5150
ActiveModel::Serializer.config.adapter = :json

docs/howto/add_root_key.md

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# How to use add root key
1+
# How to add root key
22

33
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:
44

@@ -10,19 +10,14 @@ Add the root key to your API is quite simple with AMS. The **Adapter** is what d
1010
}
1111
```
1212

13-
In order to add the correspondent root key you need to use the ```JSON``` Adapter, you can change this in an initializer:
13+
In order to add the root key you need to use the ```JSON``` Adapter, you can change this in an initializer:
1414

1515
```ruby
16-
ActiveModel::Serializer.config.adapter = :json_api
16+
ActiveModel::Serializer.config.adapter = :json
1717
```
1818

19-
or
20-
21-
```ruby
22-
ActiveModel::Serializer.config.adapter = ActiveModel::Serializer::Adapter::Json
23-
```
24-
25-
This will add the root key to all your serialized endpoints.
19+
You can also specify a class as adapter, as long as it complies with the AMS adapters interface.
20+
It will add the root key to all your serialized endpoints.
2621

2722
ex:
2823

0 commit comments

Comments
 (0)