-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
belongsTo must have corresponding hasMany, and vice versa #436
Comments
Why do you want to? |
Here are my models in a bit more detail:
So when I ask for a User's notes I perform a query to load them all into the store, and then return a filter that keeps the list up to date in case the user adds any. If I changed this to
The list of the User's notes would be kept up to date as he adds new ones, but any notes that already exist in the database wouldn't be in the list. |
Hello, I also don't want to be forced to define both side of relation. For Instance if I have Tag and three others models, which are taggable, I don't want to have to define 3 different list in Tag (tag could have for example 100 000 id's connected to it) |
@wingtsun I have a fork of ember-data in which I've removed this functionality, I can share if with you if you like. |
@wagenet confirm |
We've submitted an implementation for this with #477. |
This still seems to be the case as of revision 11. What's the sitch? |
Follow up: as of revison 11 overriding the private _inverseRelationshipFor prevents ember-data from trying to infer any inverses. DS._inverseRelationshipFor = -> |
I don't know if this has changed during the last month, but it seems to me that there were a {inverse: null} option available when defining a relationship. |
Relationships without inverses work now. I will soon be adding explicit support for inverse:null, but in most cases it should be plug&play. |
The newest ember-data seems to mandate that every belongsTo relationship has a corresponding hasMany relationship. For example, if I have models like this:
... and I attempt to set the 'author' of a Note and commit(), I get an exception in OneToManyChange.sync() because it tries to update a 'hasMany' Notes relationship in the User that doesn't exist.
Is there some way to sidestep this behavior?
The text was updated successfully, but these errors were encountered: