jeudi 12 novembre 2015

Ember-Data dynamically set belongsTo for Model

Very new to Ember (currently using 1.13) and have been stumbling with a specific problem for the past few days now.

In my project I have 3 types of models with relationships to one another:

  • ModelA hasMany ModelB & ModelC
  • Individual C records must belongsTo either A or B, but not both.

The hasMany relationships are working fine and data is being pulled from the server for all models. Linking up C with either A/B is what I'm struggling with.

Essentially, I want to display the information for C, nested amongst the information for the model it belongsTo; A/B.

C does have the id for the other model it relates to, available within the data being received.

If it's not possible to do it this way - what would my alternatives be?

For some further information, this all needs to happen under a single route (which is loading A and in turn, B & C).

Any advice is greatly appreciated.

Aucun commentaire:

Enregistrer un commentaire