Relationships in Ember


Hello all,

I’m stuck trying to implement this. I have a route that loads three models A, B and C. Here each model has an array of instances. Model B has a belongs-to relationship to one instance of model A while model C has a belongs-to relationship to one of model B. I am trying to make a component that has a property each for an instance of model A, B and C and C can be null because not all model B instances have a corresponding model C. So far I have been able to to use an each helper that runs through model A and within that helper another one that runs through model B and displays something only if model B matches with the current model A, however I’m stuck on how to do this with model C…

Any idea for a solution will be really appreciated, thanks!


I’m struggling a little bit to follow your description I think, mostly because it’s hard for me to visualize. Any code (models, templates so far) or visual examples of what you’re trying to get to would be helpful.


Let me simplify the problem.

I have a products model and a subscription model.

On a template I want to show a list of all the available products and on each product section I want to show whether the logged in user is subscribed to it or not. My products model definition the relationship it has to the subscription model is not stated however each subscription has a relationship with a user and a product.

How do I for each product run through each subscription and then match a subscription to the product if one exists?