Module: TinyCMS::Node::ClassMethods

Defined in:
lib/tiny_cms/node.rb

Instance Method Summary collapse

Instance Method Details

#reorder(ids, parent_id = nil) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/tiny_cms/node.rb', line 4

def reorder ids, parent_id = nil
  transaction do
    ids.each_with_index { |id, index| find(id).update_attributes!(:position => index, :parent_id => parent_id) } #TODO: Unefficient but can live with it
  end
  return true
rescue
  false
end