4 This acts_as extension provides the capabilities for sorting and reordering a number of objects in a list. The class that has this specified needs to have a +position+ column defined as an integer on the mapped database table.
10 class TodoList < ActiveRecord::Base
11 has_many :todo_items, :order => "position"
14 class TodoItem < ActiveRecord::Base
16 acts_as_list :scope => :todo_list
19 todo_list.first.move_to_bottom
20 todo_list.last.move_higher
23 Copyright (c) 2007 David Heinemeier Hansson, released under the MIT license