i'm working with ember data rev-11 and django tastypie. Looks like now ember-data does not support embeded resources but support sideloads (django tastypie does not support it). What is the best solution?
Thanks
i'm working with ember data rev-11 and django tastypie. Looks like now ember-data does not support embeded resources but support sideloads (django tastypie does not support it). What is the best solution?
Thanks
Ember-data still supports embedded. You just need the right configuration. Here how you can do it:
DS.RESTAdapter.map('App.Foo',{
bar:{
embedded:'always'
}
})
App.Foo = DS.Model.extend({
bar: DS.belongsTo(App.Bar,{embedded:'always'}),
});
Available values for embedded are: always and load.
load: The child records are embedded when loading, but should be saved as standalone records. In order for this to work, the child records must have an ID.
always: The child records are embedded when loading, and are saved embedded in the same record. This, of course, affects the dirtiness of the records (if the child record changes, the adapter will mark the parent record as dirty).
Similar settings apply for HasMany relationship, see this reply for more details