Created
January 30, 2011 05:13
-
-
Save knicklabs/802565 to your computer and use it in GitHub Desktop.
How to use the will paginate plugin to paginate items
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add the Will Paginate plugin to the gemfile | |
gem 'will_paginate', '3.0.pre2' | |
# Place this code in the controller | |
@items = Item.all.paginate(:page => params[:page] || 1, :per_page => 10) | |
# Place this code in the view | |
<%= will_paginate @items %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment