Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Pagination library for Rails 3, Sinatra, Merb, DataMapper, and more

This branch is 118 commits behind mislav:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
spec
.gitignore
.rspec
.travis.yml
CHANGELOG.rdoc
Gemfile
Gemfile.lock
Gemfile.rails3.0
Gemfile.rails3.0.lock
LICENSE
README.md
Rakefile
init.rb
will_paginate.gemspec

README.md

will_paginate

A pagination library for Rails, DataMapper and Sequel.

Installation:

## Rails 3: Gemfile
gem 'will_paginate', '~> 3.0.pre4'

## Rails 2.1 - 2.3: environment.rb
Rails::Initializer.run do |config|
  config.gem 'will_paginate', :version => '~> 2.3.15'
end

See installation instructions on the wiki for more info.

Basic use:

# controller: perform a query
@posts = Post.paginate(:page => params[:page], :per_page => 30)

# view: render page links
<%= will_paginate @posts %>

That's it!

New Rails 3 features:

# paginate in ActiveRecord now returns a Relation
Post.where(:published => true).paginate(:page => params[:page]).order('id DESC')

# new, shorter page method
Post.page(params[:page])

# new global per_page setting
WillPaginate.per_page = 10

See the wiki for more documentation. Ask on the group if you have usage questions. Report bugs on GitHub.

Something went wrong with that request. Please try again.