Make stuff sortable
This commit is contained in:
parent
50e853098b
commit
ee5dbcf33e
21 changed files with 161 additions and 28 deletions
|
|
@ -7,6 +7,7 @@ class ChecklistEntry < ApplicationRecord
|
|||
before_validation :set_position
|
||||
before_update :update_positions, if: :position_changed?
|
||||
|
||||
private
|
||||
def set_position
|
||||
self.position ||= (checklist.checklist_entries.pluck(:position).max || 0) + 1
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue