2014-07-20 21:48:24 +00:00
|
|
|
import ApplicationSerializer from 'ghost/serializers/application';
|
|
|
|
|
|
|
|
var UserSerializer = ApplicationSerializer.extend(DS.EmbeddedRecordsMixin, {
|
|
|
|
attrs: {
|
2014-10-24 21:09:50 +00:00
|
|
|
roles: {embedded: 'always'}
|
2014-07-20 21:48:24 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
extractSingle: function (store, primaryType, payload) {
|
|
|
|
var root = this.keyForAttribute(primaryType.typeKey),
|
|
|
|
pluralizedRoot = Ember.String.pluralize(primaryType.typeKey);
|
|
|
|
|
|
|
|
payload[root] = payload[pluralizedRoot][0];
|
|
|
|
delete payload[pluralizedRoot];
|
|
|
|
|
|
|
|
return this._super.apply(this, arguments);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
export default UserSerializer;
|