diff --git a/app/serializers/strain.js b/app/serializers/strain.js new file mode 100644 index 0000000..9fd16c7 --- /dev/null +++ b/app/serializers/strain.js @@ -0,0 +1,13 @@ +import DS from 'ember-data'; + +export default DS.RESTSerializer.extend({ + isNewSerializerAPI: true, + + serializeBelongsTo: function(snapshot, json, relationship) { + var key = relationship.key; + var belongsTo = snapshot.belongsTo(key); + key = this.keyForRelationship ? this.keyForRelationship(key, "belongsTo", "serialize") : key; + json[key] = Ember.isNone(belongsTo) ? belongsTo : +belongsTo.record.id; + } + +});