Sitelet https://github.com/pixelhandler/ember-data-extensions/wiki
Skip to content
This repository was archived by the owner on Jan 22, 2026. It is now read-only.
sbauch edited this page Mar 12, 2014 · 13 revisions

Welcome to the ember-data-extensions wiki!

To use the DS.EmbeddedAdapter and DS.EmbeddedSerializer just extend for your ApplicationAdapter and ApplicationSerializer.

For example...

App.ApplicationAdapter = DS.EmbeddedAdapter.extend();
App.ApplicationSerializer = DS.EmbeddedSerializer.extend();

App.PostSerializer = App.ApplicationSerializer.extend({
  attrs: {
    author: { embedded: 'always' },
    comments: { embedded: 'ids' }
  }
});

To track dirty/saved states between parent and embedded (child) records:

  • DS.EmbeddedInModel = DS.Model.extend(DS.EmbeddedInModelMixin);

Either extend DS.EmbeddedInModel prototype for models that are embedded in a parent record. Or, use the DS.EmbeddedInModelMixin.

  • DS.ModelWithEmbedded = DS.Model.extend(DS.ModelWithEmbeddedMixin);

Either extend DS.ModelWithEmbedded prototype for models that embed child records. Or, use the DS.ModelWithEmbeddedMixin.

Documentation

  • See the generated docs for example JSON payloads
  • The mixin docs cover options for embedding and serialization
    • { embedded: 'always' } and { embedded: 'ids' }

Ember Data API Docs:

See the Gotchas page for conventions to avoid when using embedded records.

Clone this wiki locally