Ghost/ghost/admin/app/serializers/user.js
Austin Burdine c5535e0a1b update Ember to 1.12.1/ember-data to 1.0.0-beta.18
No issue
- fixed "{{#each}}" helper in templates to use block syntax
- fixed deprecated ember.controller getter/setter function to use new syntax
- removed unnecessary pass-protect route view
2015-06-02 22:26:16 -06:00

22 lines
645 B
JavaScript

import Ember from 'ember';
import DS from 'ember-data';
import ApplicationSerializer from 'ghost/serializers/application';
var UserSerializer = ApplicationSerializer.extend(DS.EmbeddedRecordsMixin, {
attrs: {
roles: {embedded: 'always'}
},
extractSingle: function (store, primaryType, payload) {
var root = this.keyForAttribute(primaryType.modelName),
pluralizedRoot = Ember.String.pluralize(primaryType.modelName);
payload[root] = payload[pluralizedRoot][0];
delete payload[pluralizedRoot];
return this._super.apply(this, arguments);
}
});
export default UserSerializer;