I'd like to order my post results by page. Kind of like what they have on active admin... or every other website in the universe. I'm running Rails 3.2.1

For example with Active Admin you click on something like this:

http://website.com/admin/users?order=id_desc&page=2

And you have a certain number of posts on page two... then another set on page 3... etc.

I'm just wondering how to do that with a standard posts page in rails so that every page has like 10 posts.

有帮助吗?

解决方案

You definitely want to use the will_apginate gem https://github.com/mislav/will_paginate

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top