jeudi 31 décembre 2015

Recursive request of related objects

In one of my templates, I am doing:

{{#each model as |product|}}
    {{product.project.name}}
{{/each}}

EmberData does the right thing, and for each product it fetches the related project. But then, I have tried to do the following:

{{product.project.artist.username}}

Now projects are requested, but the related artist is not requested from the backend. Have I hit any kind of depth limitation? Is this specified somewhere?

I don't think I have any bug in my code. My models are just:

// product.js
export default DS.Model.extend({
    ...
    // Relationships
    project: DS.belongsTo('project'),
}

// project.js
export default DS.Model.extend({
    ...
    // Relationships
    artist: DS.belongsTo('user'),
}

// user.js
export default DS.Model.extend({
    username: DS.attr('string'),
    ...
});




Aucun commentaire:

Enregistrer un commentaire