vendredi 9 octobre 2015

ember-data 2.0 and many-to-many relations

How to handle many-to-many relations in ember 2.0 and ember-data 2.0? It seems like hasMany relations must have a belongsTo on the other side.

I guess this is what is called polymorphic relations? I see some discussions on something like this, but that seems to be for an outdated version of ember-data?

author: belongsTo('book', { polymorphic: true })

What is the proper way to do this in the latest version of ember/ember-data?

One possible solution, as I see it, would be to specify the hasMany relation on one side and do not specify anything on the other side (drop the belongsTo completely) if I will navigate the relation only one way anyway.

Aucun commentaire:

Enregistrer un commentaire