Closed Artur-Sulej closed 6 years ago
That's not a bug, that's by design. The first settings tells acts_as_list
to use 0
based indexing instead of the traditional 1
based indexing. The second settings tells acts_as_list
to add new items to the top of the list rather than the bottom.
But is it forbidden to place the item at the position 0 (with the first setting)?
The consequence of this design is that item that was created first stays forever at position 0. This is because no newly created item can take its place.
In my opinion only passing no position should make use of the add_new_at
option.
Would you be able to fork and create a failing test in our test suite for this issue? That'll help us get a better idea of what the problem is and then work toward a solution :)
@hot-cheese could you follow this up with a failing test?
I'm having the same issue apparently. top_of_list: 0
doesn't seem to be taken into account at all.
When seeding data, I have exactly the same position
s, whether I add top_of_list: 0
or not.
EDIT: nevermind, I had a scoping issue.
I'm going to close this due to inactivity.
Current setting:
acts_as_list scope: :parent_id, top_of_list: 0
Creating record withposition: 0
places it at the other end of collection, e.g. having 5 records (positions 0..4) it's placed at position 5 instead of 0. Usingacts_as_list scope: :record_id, top_of_list: 0, add_new_at: :top
makes it possible to place records at position 0.