-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
Unable to delete a parent with dependent destroy #37
Comments
Tested in latest 0.4.5:
|
@brendon Is it because of multiple scopes? Looking at positioning/lib/positioning/mechanisms.rb Line 227 in 4ce54e4
@positioned.destroyed_by_association.foreign_key == scope_column
Could that be the reason? |
Hi @onerinas, that's an interesting one. It appears to be failing to detect that it's being deleted via a scope. It shouldn't matter but try not passing in an array:
Here's the current test for this scenario: positioning/test/test_positioning.rb Lines 568 to 582 in 4ce54e4
If you feel up to it, can you try to recreate the issue with a test and then create a PR with that failing test and I'll see what I can find. What version or Rails are you on? |
@brendon In my actual code, I have more than one column used and hence the array like this:
I’ll try to add a test to see if it fails. I hope that would be helpful. |
It’ll definitely be helpful. Is your parent model double linked to the child with two dependent: destroys? |
I'm seeing below error when deleting a parent model which has dependent destroy
e.g,
Error occurs when I do
todo_list.destroy
which has multiple todos and has position. I have commented out few lines to add some context. I don't think that's the reason but still keeping it in case it's helpful.I'm on on
0.2.6
. Any other details I can add that might help find what's happening?The text was updated successfully, but these errors were encountered: