Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要用 kaminari 加载页面范围。我的意思是这样的:
模型.page(1..5).per(10)
所以我会在第一页获得前 50 个项目,然后每页继续 10 个项目。
有什么建议么?
我通过以下方式解决了同样的问题:
if first_load ar = [] (1..n).each do |p| ar << Model.page(p) end ar.flatten else Model.page(n).per(10) end