Closed dan98765 closed 3 months ago
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: https://github.com/brendon/acts_as_list/pull/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
.
move_higher and move_lower do not respect sequential_updates=true
move_higher method: https://github.com/brendon/acts_as_list/blob/eb972421e2b9db70b3993b13a958f57c89b0e6b0/lib/acts_as_list/active_record/acts/list.rb#L98
Most of the methods in
list.rb
end up callinginsert_at_position
eventually, which will eventually checksequential_updates?
and behave accordingly. Not somove_higher
andmove_lower
.Suggestions:
insert_at_position
somehowsequential_updates?
and behave differently if truesequential_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.