acts_as_list
ModuleActiveRecord::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]