Rails 3 非 ActiveRecord 结果的分页
我的 Rails 3 应用程序使用 sphinx 对文本文件执行搜索,并在登陆页面视图上返回结果集合:类似
<%= render :partial => "result", :collection => @results %>
Rails 的结果分页方式是什么?我知道有像 will_paginate 这样的插件,但我没有使用 ActiveRecord (我的应用程序甚至不使用数据库)。
Javascript 解决方案是最好的方法吗?我还想在网址中保留 REST,即“/search?query=hello&page=2”
My rails 3 app uses sphinx to perform search on text files, and I return a collection of results on the landing page view: something like
<%= render :partial => "result", :collection => @results %>
What is the Rails way to do pagination for the results? I know there are plugins like will_paginate, but I'm not using ActiveRecord (my app doesn't even use a db).
Is a Javascript solution the best way to go? I want to also maintain REST in the url, ie "/search?query=hello&page=2"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这里有人已经这样做了: 如何将 will_paginate 与非 ActiveRecord 集合/数组一起使用
Here is someone who has already done so: How to use will_paginate with non-ActiveRecord collection/array