Mislav Marohnić edited this page Sep 20, 2016 · 7 revisions

To install will_paginate in Rails 3+ or other frameworks:

## Gemfile for Rails 3+, Sinatra, or Merb
gem 'will_paginate', '~> 3.1.1'

Then run bundle install. It will automatically hook into Rails or Merb on application boot.

A Sinatra app needs a couple of extra requires:

## Sinatra app:
require 'will_paginate'
require 'will_paginate/active_record'  # or data_mapper/sequel

For Padrino apps you need to manually register the Sinatra extension:

## app/app.rb
register WillPaginate::Sinatra

## config/boot.rb
Padrino.before_load do
  require 'will_paginate/view_helpers/sinatra'
  require 'will_paginate/data_mapper'

Padrino.after_load do

Alternatively, you can avoid manual will_paginate install by using Padrino recipes:

$ padrino g plugin will_paginate

Rails 2.3.x or older

will_paginate 3.0+ will not work on Rails 2. In an older version of Rails, you'll have to use will_paginate 2.3:

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

Then run rake gems:install.

For Rails 2.0 or older, a simple require will suffice:

## Rails 1.2 - 2.0: environment.rb
require 'will_paginate'
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.