Action Pack pagination for Active Record collections
DEPRECATION WARNING: Pagination will be moved to a plugin in Rails 2.0. Install the classic_pagination plugin for forward compatibility:
script/plugin install svn://errtheblog.com/svn/plugins/classic_pagination
The Pagination module aids in the process of paging large collections of Active Record objects. It offers macro-style automatic fetching of your model for multiple views, or explicit fetching for single actions. And if the magic isn‘t flexible enough for your needs, you can create your own paginators with a minimal amount of code.
The Pagination module can handle as much or as little as you wish. In the controller, have it automatically query your model for pagination; or, if you prefer, create Paginator objects yourself.
Pagination is included automatically for all controllers.
For help rendering pagination links, see ActionView::Helpers::PaginationHelper.
Automatic pagination for every action in a controller
class PersonController < ApplicationController
paginate :people, :order => 'last_name, first_name',
:per_page => 20
Source : http://api.rubyonrails.org/classes/ActionController/Pagination.html