mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-14 09:52:09 +03:00
9eac05e082
closes #6018 - added keyForAttribute method in application serializer - override keyForAttribute in settings serializer to not apply camelCase/underscore conversion - rename under_scored properties to camelCased
28 lines
667 B
JavaScript
28 lines
667 B
JavaScript
import Ember from 'ember';
|
|
import RESTSerializer from 'ember-data/serializers/rest';
|
|
|
|
const {
|
|
decamelize
|
|
} = Ember.String;
|
|
|
|
export default RESTSerializer.extend({
|
|
serializeIntoHash(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
|
|
let root = Ember.String.pluralize(type.modelName);
|
|
let data = this.serialize(record, options);
|
|
|
|
// Don't ever pass uuid's
|
|
delete data.uuid;
|
|
|
|
hash[root] = [data];
|
|
},
|
|
|
|
keyForAttribute(attr) {
|
|
return decamelize(attr);
|
|
}
|
|
});
|