Installation Guide

Installing will_paginate is straightforward using RubyGems. Add it to your application's Gemfile to get started.

Add this line to your application's Gemfile:

gem 'will_paginate', '~> 4.0'

And then execute:

$ bundle install

Framework Integration

Ruby on Rails

For Rails applications, will_paginate integrates automatically using a Railtie. After adding the gem to your Gemfile and running bundle install, the pagination methods will be available in your models and the view helpers will be available in your templates. No further setup is required.

Sinatra

To use the view helpers in a Sinatra application, you need to require the specific Sinatra integration file and register the helpers:

require 'sinatra'
require 'will_paginate/view_helpers/sinatra'

# In your main application file or a helpers module
helpers WillPaginate::Sinatra::Helpers

# ... rest of your Sinatra app

Hanami

For Hanami views, you can include the provided helper module:

require 'will_paginate/view_helpers/hanami'

# In a view or a shared helpers module
include WillPaginate::Hanami::Helpers

Other ORMs (Sequel, Mongoid)

If you are using Sequel or Mongoid in a non-Rails application, you will need to require the specific integration file to enable pagination methods on your models:

# For Sequel
require 'will_paginate/sequel'

# For Mongoid
require 'will_paginate/mongoid'