2015-02-13 07:22:32 +03:00
|
|
|
import Ember from 'ember';
|
|
|
|
import DS from 'ember-data';
|
2015-08-19 14:55:40 +03:00
|
|
|
|
2015-10-28 14:36:45 +03:00
|
|
|
const {RESTSerializer} = DS;
|
|
|
|
|
|
|
|
export default RESTSerializer.extend({
|
|
|
|
serializeIntoHash(hash, type, record, options) {
|
2014-05-09 09:00:10 +04:00
|
|
|
// Our API expects an id on the posted object
|
|
|
|
options = options || {};
|
|
|
|
options.includeId = true;
|
|
|
|
|
|
|
|
// We have a plural root in the API
|
2015-10-28 14:36:45 +03:00
|
|
|
let root = Ember.String.pluralize(type.modelName);
|
|
|
|
let data = this.serialize(record, options);
|
2014-05-09 09:00:10 +04:00
|
|
|
|
|
|
|
// Don't ever pass uuid's
|
|
|
|
delete data.uuid;
|
|
|
|
|
|
|
|
hash[root] = [data];
|
|
|
|
}
|
2014-06-09 15:02:51 +04:00
|
|
|
});
|