yearl 发表于 2013-2-7 16:37:53

acts_as_list

Module
ActiveRecord::Acts::List::InstanceMethods    In:vendor/rails/activerecord/lib/active_record/acts/list.rb       
http://api.rubyonrails.org/classes/ActiveRecord/Acts/List/InstanceMethods.html#M000686
 
<!--banner header -->
<div class="description">All the methods available to a record that has had acts_as_listspecified. Each method works by assuming the object to be the item in thelist, so chapter.move_lower would move that chapter lower in thelist of all chapters. Likewise, chapter.first? would return trueif that chapter is the first in the list of all chapters.
 
 
 
Example=======class TodoList < ActiveRecord::Base    has_many :todo_items, :order => "position"endclass TodoItem < ActiveRecord::Base    belongs_to :todo_list    acts_as_list :scope => :todo_listendtodo_list.first.move_to_bottomtodo_list.last.move_higher
页: [1]
查看完整版本: acts_as_list