Skip to content

Instantly share code, notes, and snippets.

@ohadlevy
Created November 5, 2014 12:51
Show Gist options
  • Save ohadlevy/28a00b775d7242b85719 to your computer and use it in GitHub Desktop.
Save ohadlevy/28a00b775d7242b85719 to your computer and use it in GitHub Desktop.
import DS from 'ember-data';
export default DS.RESTSerializer.extend({
extractArray: function(store, type, payload) {
// 'foreman-experimental-ui@model:setting:'
var wrapped_payload = {};
var model_name = type.toString().split(":")[1];
wrapped_payload[model_name] = payload['results'];
// TODO: handle additional API result (params, counters etc)
return this._super(store, type, wrapped_payload);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment