Skip to content

Instantly share code, notes, and snippets.

@baroquon
Created January 23, 2015 05:37
Show Gist options
  • Save baroquon/31f5d0a8aa11dd41d97c to your computer and use it in GitHub Desktop.
Save baroquon/31f5d0a8aa11dd41d97c to your computer and use it in GitHub Desktop.
app/serializers/application.js
import DS from 'ember-data';
export default DS.RESTSerializer.extend(DS.EmbeddedRecordsMixin, {
primaryKey: 'ID',
extractArray: function(store, type, payload) {
var payloadTemp = {};
payloadTemp[type.typeKey] = payload;
return this._super(store, type, payloadTemp);
},
extractSingle: function(store, type, payload, id) {
var payloadTemp = {};
payloadTemp[type.typeKey] = [payload];
return this._super(store, type, payloadTemp, id);
},
attrs: {
items: { embedded: 'always' },
acf: { embedded: 'always' }
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment