Edit characteristic
This commit is contained in:
parent
24c870353f
commit
f25fae0a83
6 changed files with 65 additions and 6 deletions
18
app/serializers/characteristic.js
Normal file
18
app/serializers/characteristic.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
import DS from 'ember-data';
|
||||
import Ember from 'ember';
|
||||
|
||||
export default DS.RESTSerializer.extend({
|
||||
isNewSerializerAPI: true,
|
||||
|
||||
serializeHasMany: function(snapshot, json, relationship) {
|
||||
var key = relationship.key;
|
||||
var hasMany = snapshot.hasMany(key);
|
||||
key = this.keyForRelationship ? this.keyForRelationship(key, "hasMany", "serialize") : key;
|
||||
|
||||
json[key] = [];
|
||||
hasMany.forEach((item) => {
|
||||
json[key].push(+item.get('id'));
|
||||
});
|
||||
}
|
||||
|
||||
});
|
Reference in a new issue