而在rails 2.0.2中則用了will_paginate 插件,下載地址:
http://www.javaeye.com/topic/154713
使用方法:
1,把下載的will_paginate拷貝到項目的vendor->plugins 目錄下
2,controller中:


:page 參數是will_paginate默認的,不是用戶定義的,@message是定義的實例變量,Message是數據庫里的表對象,:per_page是每頁顯示的條數
3,view中:

就這么簡單,你的分頁就實現了!
另外:添加傳參 <%= will_paginate @items, :params=>{:flag=>'user'} %>
參數參考:
ref: http://gitrdoc.com/mislav/will_paginate/tree/master/ (API)
ref: http://groups.google.com/group/will_paginate/browse_thread/thread/e65fab5aa96c85ae
設置自己的樣式:
http://www.aygfsteel.com/fl1429/archive/2009/03/25/261802.html
link:
http://bbs.railschina.com/thread-421-1-4.html
http://www.cnblogs.com/ayuan/archive/2008/03/12/1102001.html
write by feng |