Clean up species id in strain serializer

This commit is contained in:
Matthew Dillon 2015-07-10 15:28:27 -08:00
parent b78aa571ee
commit 99c94e9c7b

13
app/serializers/strain.js Normal file
View file

@ -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;
}
});