Skip to content

Instantly share code, notes, and snippets.

@wycats
Created January 6, 2013 14:25
Show Gist options
  • Save wycats/4467501 to your computer and use it in GitHub Desktop.
Save wycats/4467501 to your computer and use it in GitHub Desktop.
// If you're using an off-the-shelf adapter:
DS.RESTAdapter.map('Links.List', {
urls: { embedded: 'load' }
});
// Otherwise:
App.MyAdapter = DS.RESTAdapter.extend({
// ...
});
App.Store = DS.Store.extend({
revision: 11, // or latest revision
adapter: 'App.MyAdapter'
});
App.MyAdapter.map('Links.List', {
urls: { embedded: 'load' }
});

Note that you should use:

  • embedded: 'load' if you are loading the data embedded in the parent, but the child records have their own ID and you want to save them separately
  • embedded: 'always' if you are loading the data embedded in the parent, and you also need to save them embedded in the parent. If the child records have no id, this is the only embedded option that can work.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment