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
|
|
|
|
|
|
|
export default DS.RESTSerializer.extend({
|
2015-09-03 14:06:50 +03:00
|
|
|
|
|
|
|
isNewSerializerAPI: true,
|
|
|
|
|
2014-05-09 09:00:10 +04:00
|
|
|
serializeIntoHash: function (hash, type, record, options) {
|
|
|
|
// Our API expects an id on the posted object
|
|
|
|
options = options || {};
|
|
|
|
options.includeId = true;
|
|
|
|
|
|
|
|
// We have a plural root in the API
|
2015-06-03 05:56:42 +03:00
|
|
|
var root = Ember.String.pluralize(type.modelName),
|
2014-05-09 09:00:10 +04:00
|
|
|
data = this.serialize(record, options);
|
|
|
|
|
|
|
|
// Don't ever pass uuid's
|
|
|
|
delete data.uuid;
|
|
|
|
|
|
|
|
hash[root] = [data];
|
|
|
|
}
|
2014-06-09 15:02:51 +04:00
|
|
|
});
|