試圖瞭解will_paginate的paginate
方法的選項:幫忙翻譯will_paginate文檔?
:page — REQUIRED, but defaults to 1 if false or nil
:per_page — defaults to CurrentModel.per_page (which is 30 if not overridden)
:total_entries — use only if you manually count total entries
:count — additional options that are passed on to count
:finder — name of the ActiveRecord finder used (default: 「find」)
page
,per_page
和finder
非常簡單。
total_entries
and count
- 不明白「只有手動計數條目時才使用」?他們是否設想了一種場景,您將運行單獨的計數查詢,然後將結果作爲選項傳遞給paginate
?你會這樣做的情況是什麼?
「傳遞給計數的附加選項」 - 有哪些選項可用? 「傳遞」到count
方法???
提供:total_entries似乎沒有工作了。 COUNT(*)查詢仍然在數據庫中 – 2012-11-21 06:35:57