-
Notifications
You must be signed in to change notification settings - Fork 114
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
Model.update broken for many-to-many relations #23
Comments
Sorry for the delay here -- was on a trip for a couple of weeks. Looks like I didn't have a test in place to catch that regression. Wrote test to catch regression and fixed it in 72daf37, will make a new release later today. |
Sure. In the meantime, I wrote a utility function for myself that does fairly similar behavior. |
Can u give me more info about that? I am trying to update a model with a many relationship and im getting with that error: |
Self response: If we go to the file Model.js we can see in the line 425
That is causing a bug on the update of an empty many relationship array. Is not deleting any relationship but instead is adding links to relationships. That is causing a problem on the update process throwing the error that I pasted before We can avoid that changing the line to that:
|
Model.update()
checks to see if a given field to update is a many-to-many relation. If so, it tries to use a function calledarrayDiffActions()
to determine which IDs have been added or removed from the existing list. It's trying to import that function from utils.js, but the function no longer exists. Looks like it was removed in commit 560c81d on May 9, while working on adding use of the immutable ops lib.As a result,
Model.update()
currently breaks due to the undefined function reference.The text was updated successfully, but these errors were encountered: