Trying out the will_paginate Ruby gem
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


We're going to learn about pagination. Sometimes when there are large number of records to display, we'd rather have a user page through the records (restricting the number displayed per page) than have them scroll forever and ever.

Start by copying your solution to Blog 2 into the source directory.

To Do:

Release 0: Install the will_paginate gem

We're going to use the will_paginate gem. Edit your Gemfile and add the line

gem 'will_paginate', '~> 3.0.0'

Run bundle install to make sure the gem is installed.

Release 1 : Paginate Posts

Every page that displays a list of posts should be paginated: the list of all posts, the list of posts for a given tag, and the list of posts by a given author.

The will_paginate gem adds methods to your ActiveRecord classes to support pagination. Read through the will_paginate documentation to figure out how it works.

Additionally, it comes with a view helper to display a nice list of page links for any paginated ActiveRecord object. Use it!