我使用will_paginate 「2.3.15」 爲我的Rails應用程序will_paginate - 錯誤 - 未定義的方法`TOTAL_PAGES'
在我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>
我的rails版本3.0.0 和紅寶石版本1.8.7
plz幫助
感謝阿德里安您的快速反應我用這個@units = Unit.paginate(:頁面=> PARAMS [:頁面]:爲了=> 'created_at DESC')仍然得到同樣的錯誤 – 2011-06-15 10:22:02
我會覺得在這個版本的will_paginate中的錯誤,但我不確定。也許你可以嘗試更新到更新的版本。 – 2011-06-15 11:39:52