Infered ember data models don't respect the inverse arg
lougreenwood opened this issue · 1 comments
lougreenwood commented
Bug?
When an ED relationship is one-way, it should be marked as inverse: null
, this is essential for mirage models, due to #996.
However, when allowing Mirage to infer the model from ED (so not explicitly defining a mirage model), the inverse: null
does not seem to brought along, so the above problem is encountered and the only solution is to define a mirage model.
However, this is troublesome, since this then adds a maintenance burden of keeping the real ED models and mirage models in sync.
lougreenwood commented
Some research for fixing:
- Looks like
ember-cli-mirage
should pick upinverse:null
option here and pass tomirageJs
ember-cli-mirage/addon/ember-data.js
Line 77 in 324a032
mirageJs
receives theopts
forbelongsTo
here:- However, I assume that
mirageJs
doesn't set null inverse here since it ignore null value forinverse
, so no inverse is detected, so theinverse
option is skipped in something likemodel.hasInverseFor