move_higher and move_lower do not respect sequential_updates=true
dan98765 opened this issue · 2 comments
move_higher and move_lower do not respect sequential_updates=true
move_higher method:
Most of the methods in list.rb
end up calling insert_at_position
eventually, which will eventually check sequential_updates?
and behave accordingly. Not so move_higher
and move_lower
.
Suggestions:
- Have them also use
insert_at_position
somehow - Have them do their own check of
sequential_updates?
and behave differently if true - Update README section about
sequential_updates
option to warn that these methods should never be used if you have a unique constraint in your table.
I'm happy to help out, but would appreciate maintainer(s) giving a sanity check here first as to if this is really an issue or I'm missing something, and which suggestion here (or a new one altogether) they prefer.
Hi @dan98765, you're right about sequential_updates
only being applied to some sections of the code. I think this was an oversight by the person who originally proposed that code. If you're keen to do a PR around adding sequential update support to those methods I'd be happy to look it over for you. Someone else is also working on a refactor of the overall logic here: #372 but the proposal there is to remove these helper methods from the core and add them back in as an option.
If this is still an issue for you particularly let me know. I'm going to close it (just tidying up). Check out https://github.com/brendon/positioning as an alternative take on the positioning problem. It's largely compatible with the database structure of acts_as_list
.