Module: Positionable::ClassMethods

Defined in:
app/models/positionable.rb

Instance Method Summary collapse

Instance Method Details

#update_positions(id_pos_pairs) ⇒ Object



11
12
13
14
15
16
17
# File 'app/models/positionable.rb', line 11

def update_positions(id_pos_pairs)
  self.transaction do
    id_pos_pairs.each do |pair|
      self.find(pair[:id]).update_attributes!(:position => pair[:position])
    end
  end
end