将分页:限制结果数 [英] Will Paginate: Limit number of results

查看:90
本文介绍了将分页:限制结果数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用会为宝石做红宝石分页的宝石.我正在使用will paginate来吸引一群人并在一个字段上进行排序.我想要的只是其中的前100个.本质上是高层人物.我看不出要这样做.我将如何处理?谢谢

Im using the will paginate gem for ruby. I am using will paginate to get a bunch of people and sorting on a field. What I want is only the first 100 of those. Essentially the top people. I cant seeem to do this. How would i go about it? Thanks

推荐答案

people = Person.limit(100).paginate(:per_page => 5)

这篇关于将分页:限制结果数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆