Method: HasOrder::InstanceMethods#move_before
- Defined in:
- lib/has_order.rb
#move_before(node) ⇒ Object
97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/has_order.rb', line 97 def move_before(node) self.class.transaction do node_pos = node.position pos = node_pos > 0 ? node_pos - 1 : node_pos if list_scope.at(pos).exists? pos = node_pos node.and_higher.shift! end self.position = pos save! end end |