Skip to content

Commit

Permalink
[DOC]: default behaviour of serializers/json shouldSerializeHasMany m…
Browse files Browse the repository at this point in the history
…ethod (#5516)
  • Loading branch information
jelhan authored and bmac committed Jul 14, 2018
1 parent e4978d3 commit 43f2077
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions addon/serializers/json.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ const JSONSerializer = Serializer.extend({
});
```
You can also remove attributes by setting the `serialize` key to
`false` in your mapping object.
You can also remove attributes and relationships by setting the `serialize`
key to `false` in your mapping object.
Example
Expand All @@ -163,6 +163,10 @@ const JSONSerializer = Serializer.extend({
Note that the `admin` is now not included in the payload.
Setting `serialize` to `true` enforces serialization for hasMany
relationships even if it's neither a many-to-many nor many-to-none
relationship.
@property attrs
@type {Object}
*/
Expand Down Expand Up @@ -845,6 +849,9 @@ const JSONSerializer = Serializer.extend({
/**
Check if the given hasMany relationship should be serialized
By default only many-to-many and many-to-none relationships are serialized.
This could be configured per relationship by Serializer's `attrs` object.
@method shouldSerializeHasMany
@param {DS.Snapshot} snapshot
@param {String} key
Expand Down

0 comments on commit 43f2077

Please sign in to comment.