六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 11|回复: 0

acts_as_list

[复制链接]

升级  62%

7

主题

7

主题

7

主题

童生

Rank: 1

积分
31
 楼主| 发表于 2013-2-7 16:37:53 | 显示全部楼层 |阅读模式
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"  end  class TodoItem < ActiveRecord::Base    belongs_to :todo_list    acts_as_list :scope => :todo_list  end  todo_list.first.move_to_bottom  todo_list.last.move_higher
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表