Har*_*shi 6 ruby-on-rails will-paginate
我正在使用will_paginate"2.3.15"作为我的rails应用程序
在我的units_controller.rb中
def index
@units = Unit.paginate(:all ,:page => params[:page], :order => 'created_at DESC')
end
in my views(index)
<%= will_paginate(@units)%>
but it gives error
undefined method `total_pages' for #<ActiveRecord::Relation:0xb523dc>
Run Code Online (Sandbox Code Playgroud)
我的rails版本3.0.0和ruby版本1.8.7
请帮助
为什么要添加:all? 从will_paginate wiki你可能应该使用:
@units = Unit.paginate(:page => params[:page], :order => 'created_at DESC')
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7059 次 |
| 最近记录: |