-
-
Notifications
You must be signed in to change notification settings - Fork 357
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
Position is set incorrectly when circular dependencies exist #153
Comments
With activerecord 4.1.2 .. 4.2.0, it fails like this:
With activerecord 4.1.1 or earlier, it passes. |
Here are the queries it runs with activerecord 4.2.0 (failing):
And with 4.1.1 (passing):
|
This is starting to look more like an ActiveRecord bug rather than an acts_as_list issue. It appears that |
I believe the reason this bug surfaced in our application is related to rails/rails#18704, but there's still an issue with acts_as_list in the case where there's truly a circular dependency (and therefore the It fails with:
|
I think the fundamental issue here is that when the caller inserts an element in a list at a specific position outside of the range There are two possible ways to fix this:
What do you think? |
Thanks for the detailed debugging, I'll go through this today. |
👍 |
@afn, could you rebase this to confirm that it's still a bug? Let's try to get this one solved :) |
Sure - I've rebased amitree/acts_as_list and it still fails. |
Thanks for that. Could you do a pull request for this so we can look at the diff's? |
@afn, can you introduce the failing tests as a PR and we can go from there. |
Thanks @afn :) Good to have it linked here :) Can you rebase your code to master and then we can go from there :) |
Hi @afn, can we move this one along? I'm keen to close it off :) |
Sure! See #153 (comment) — I was waiting for some feedback on the preferred solution. |
Ah righty :) There was a recent PR accepted that dealt with disparate position integers. Could you give master a whirl and see if it still causes this problem? |
Yep, I think that PR took care of it. Thanks! |
Glad to hear it :) |
We saw some unusual behavior in our system, where items were being incorrectly reordered by
acts_as_list
. It seems that in order to reproduce the bug, you need a relatively complex set of associations, and the list needs to be scoped. See the failing test case below...The text was updated successfully, but these errors were encountered: