Traversing HasMany to HasMany from Both Sides and Sideloading


#1

I’m using the fixture adapter and I’m loading both a schedule. I have events, and performers. When I traverse the relationship in the template, it only works when I sideload it on both fixtures.

I’m using Ember Data 1.0.0-beta.6 and Ember 1.4.0.

App.Event = DS.Model.extend({
    performers: DS.hasMany('performer', {embedded: 'always', async: true})
});
App.Performer = DS.Model.extend({
    events: DS.hasMany('event', {async: true})
});

App.Performer.FIXTURES = [{
"id":123,
"name":"John Doe"];

App.Event.FIXTURES = [{
"id":789,
"name":"Hollywood Bowl Opening Show",
"performers":[123]}];


// Event Route & Template

{{event.performers}} // This returns an array with John Doe

// Performer Route & Template

{{performer.events}} // This returns an empty array!

Why can’t I just load this from one side? Can Ember dynamically load these relationships once and then be able to reference them from both models?


#2

I think you can’t have async and embedded on the same attr