brendon / acts_as_list

An ActiveRecord plugin for managing lists.

Home Page:http://brendon.github.io/acts_as_list/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Reorder on delete?

oyeanuj opened this issue · comments

commented

Hey @brendon, back again with a reorder related question! I'm not sure if we have already discussed this in another conversation in this repo but I couldn't find any documentation on what to expect when we delete an item. Can the other items automatically reorder?

Case:
Item A at Position 1
Item B at Position 2

If I delete Item A, it seems like Item B is not updating to position 1. Then when I add Item C, it automatically gives it position 1 rather than after Item B.

Are both these behaviors to be expected?

Hi @oyeanuj, I hope all is well :D

acts_as_list should renumber the positions if you delete an item. It should also add an item to the end of the list. My guess is that there's an error with your scoping? What's your config?

commented

Ah, I think you are right about the scope issue. That might be it, thank you!

No worries :D