Module: FlatPriority
- Extended by:
- ActiveSupport::Concern
- Included in:
- BiovisionComponent, ContactMethod, Language
- Defined in:
- app/models/concerns/flat_priority.rb
Overview
Model has flat priority field
Adds sorting items by priority
Instance Method Summary collapse
Instance Method Details
#change_priority(delta) ⇒ Object
22 23 24 25 26 |
# File 'app/models/concerns/flat_priority.rb', line 22 def change_priority(delta) swap_priority_with_adjacent(priority + delta) self.class.ordered_by_priority.map { |e| [e.id, e.priority] }.to_h end |