-
Notifications
You must be signed in to change notification settings - Fork 440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Having multiple hasMany relationship throws unresolvable inverse error #996
Comments
You should know there have been some significant improvements to the ORM in the 0-3 beta series, read this post for more: www.ember-cli-mirage.com/blog/2017/01/09/0-3-0-beta-series/. I'd encourage you to use it since you're dealing with hasMany relationships. As for your particular problem you might have luck defining a |
I'm using v0.3.0-beta.5 but {inverse: null} on the mirage model seems to have no effect and I get the same error that @kfoisy mentions above. Is there a workaround to this? |
Just as a heads-up for anybody that comes across this issue. As @samselikoff pointed out if you declare these relationships // mirage/models/user.js
export default Model.extend({
friends: hasMany('user', { inverse: null }),
enemies: hasMany('user', { inverse: null })
}); |
It appears this issue has been resolved :) |
Can this be addressed without having to use a custom mirage model. It seems that defining Being forced to use custom mirage models brings the problem of having to keep them in sync with the real model, which is something I'd prefer to avoid.
|
If I set up an app with a model that has multiple
hasMany
relationships to the same model, I get an error about the inverse relationships not being set up. Trying to add the relationships does not appears to fix the problem. Specifically, if I have following models set up in my app:Mirage throws the following error:
Mirage: Your 'post' model definition has multiple possible inverse relationships of type 'comment'.
Is there any way to resolve this that I'm not seeing?
Note: This appears to have started being a problem in v0.2.2
The text was updated successfully, but these errors were encountered: