brendon / acts_as_list

An ActiveRecord plugin for managing lists.
http://brendon.github.io/acts_as_list/
MIT License
2.04k stars 355 forks source link

Re-ordering at specific position #318

Closed oyeanuj closed 6 years ago

oyeanuj commented 6 years ago

Hi @brendon, quick question. Going through the docs, I couldn't find a method that would allow me to move an existing list_item to a new position and in effect, re-ordering rest of the items around it. It seems like move_higher or move_lower is the only thing available for that?

Am I missing something? Happy to PR the docs if there is some work around.

Thank you!

brendon commented 6 years ago

Hi @oyeanuj :) You can just set the position of the existing item and upon saving, it will move other items out of the way to make room. Generally you'd need to know the position of the item you'd like to insert your current item in front of. Hope that helps :)

oyeanuj commented 6 years ago

Got it, thanks so much!