I’m the maintainer of the acts_as_list
and ranked-model
gems and recently I’ve written a new positioning gem of my own. It’s named unimaginatively: positioning
.
It takes the best of both of the aforementioned gems and adds an advisory lock to guarantee sequential list operations:
- Doesn’t pollute the model namespace (inspired by
ranked-model
) - Uses sequential integer position values like
acts_as_list
. - Honours uniqueness constraints when expanding and contracting space in the list.
- Promotes the use of relative positioning over explicit positioning (e.g.
before: other_list_member
) - Does its best to prevent gaps in the position sequence via clamping and an advisory lock.
- Allows more than one list to exist per model (like
ranked-model
) - Scope by
belongs_to
relationship, model column, a combination of the two, or not at all! - Automatically handles moving list items between scopes (like
acts_as_list
andranked-model
).
I’m using it in production and encourage others to take a look and provide feedback.
I’ll still be maintaining acts_as_list
and ranked-model
so don’t fret