annotate lib/plugins/acts_as_list/README @ 1484:51364c0cd58f redmine-2.4-integration

Merge from live branch. Still need to merge manually in files overridden by plugins.
author Chris Cannam
date Wed, 15 Jan 2014 09:59:14 +0000
parents 433d4f72a19b
children
rev   line source
Chris@0 1 ActsAsList
Chris@0 2 ==========
Chris@0 3
Chris@0 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.
Chris@0 5
Chris@0 6
Chris@0 7 Example
Chris@0 8 =======
Chris@0 9
Chris@0 10 class TodoList < ActiveRecord::Base
Chris@0 11 has_many :todo_items, :order => "position"
Chris@0 12 end
Chris@0 13
Chris@0 14 class TodoItem < ActiveRecord::Base
Chris@0 15 belongs_to :todo_list
Chris@0 16 acts_as_list :scope => :todo_list
Chris@0 17 end
Chris@0 18
Chris@0 19 todo_list.first.move_to_bottom
Chris@0 20 todo_list.last.move_higher
Chris@0 21
Chris@0 22
Chris@0 23 Copyright (c) 2007 David Heinemeier Hansson, released under the MIT license