jeudi 15 novembre 2018

Ember data model explicit inverse relationships

I’m struggling with explicit inverse relationships: https://guides.emberjs.com/release/models/relationships/#toc_explicit-inverses.

If 4 instances of the blog-post model can be associated with a comment (onePost, twoPost, redPost, bluePost), how come the inverse is set on the class definition of the blog-post and not at an instance level?

Surely all instances that are created from that model definition now will now be inverse to redPost? How do I create, say, a blog-post that I would like to be associated with the comment's bluePost attribute?

The closest answers I've found are Ember - Understanding Inverse Relationships and Setting the inverse option dynamically/conditionally in ember-data? but the first one oversimplifies the problem as to not be a relevant answer and the second one went unanswered.

Thanks in advance.




Aucun commentaire:

Enregistrer un commentaire