mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-30 21:40:39 +03:00
983110d931
no issue - add eslint-plugin-ember, configure no-old-shims rule - run `eslint --fix` on `app`, `lib`, `mirage`, and `tests` to move imports to the new module imports - further cleanup of Ember globals usage - remove event-dispatcher initializer now that `canDispatchToEventManager` is deprecated
22 lines
609 B
JavaScript
22 lines
609 B
JavaScript
import RESTSerializer from 'ember-data/serializers/rest';
|
|
import {decamelize} from '@ember/string';
|
|
import {pluralize} from 'ember-inflector';
|
|
|
|
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 = pluralize(type.modelName);
|
|
let data = this.serialize(record, options);
|
|
|
|
hash[root] = [data];
|
|
},
|
|
|
|
keyForAttribute(attr) {
|
|
return decamelize(attr);
|
|
}
|
|
});
|