DS.JSONSerializer#serializeHasMany()

serializeHasMany (snapshot, json, relationship)

Defined in addon/serializers/json.js:1206

serializeHasMany can be used to customize how DS.hasMany properties are serialized.

Example

app/serializers/post.js
import DS from 'ember-data';

export default DS.JSONSerializer.extend({
  serializeHasMany: function(snapshot, json, relationship) {
    var key = relationship.key;
    if (key === 'comments') {
      return;
    } else {
      this._super.apply(this, arguments);
    }
  }
});

Parameters:

snapshot DS.Snapshot
json Object
relationship Object
doc_EmberJs
2016-11-30 16:49:58
Comments
Leave a Comment

Please login to continue.