Method: HasOrder::InstanceMethods#move_to

Defined in:
lib/has_order.rb

#move_to(pos) ⇒ Object



86
87
88
89
90
91
92
93
94
95
# File 'lib/has_order.rb', line 86

def move_to(pos)
  self.class.transaction do
    if node = list_scope.at(pos).first
      node.and_higher.shift!
    end

    self.position = pos
    save!
  end
end