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

highter_items returns items with the same position value #247

Closed james-logan closed 7 years ago

james-logan commented 7 years ago

Hey, this isn't really an issue, just a question.

Is there a reason this line is using <= and not just <

In the off chance that something in the database has a position value that is equal to another item in the list, it will show up in the list of 'higher_items', won't it?

brendon commented 7 years ago

Hi @james-logan, This was added with the extra constraint on the next line that excludes the current record. The assumption is that there may be other records with the same position value, and we assume that those records are higher than this record.

This concept is utilised in the move up/down logic too from memory.

I hope that helps explain it :)

brendon commented 7 years ago

Feel free to close the issue or ask further questions :)