Skip to content
Plugin to integrate Will Paginate with the Roda framework
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.


Use this plugin to use Will Paginate from Roda.


Add this line to your application's Gemfile:

gem 'roda-will_paginate'

And then execute:

$ bundle

Or install it yourself as:

$ gem install roda-will_paginate


Add the plugin directive to your app

plugin :will_paginate

On your views you can use the same method you would use on a Rails app ie.

<%= will_paginate @collection %>

to include pagination links.

Links generated for pagination will include a parameter page=[page_no] that will have to be handled correctly by your application when requesting different pages.

Making collections work with Will Paginate

Please take into consideration that this plugin only takes care of generating the links to pages on your views, your paginated collections should comply with WillPaginate's requirements, these are defined in

If you are using Sequel with your Roda app, you can easily enable to appropriate functionality. You need to enable the Sequel pagination extension; DB.extension(:pagination) and require will_paginate/sequel in your app class.

Otherwise, you will need to implement the interface yourself. Include WillPaginate::CollectionMethods and add current_page, per_page, offset, total_entries, total_pages as methods on your collection.

Customizing pagination links

In case you would like to customize the generated links you need to implement a renderer. Please take a look at Will Paginate's documentation to learn how to create your own renderers.

Alternative Twitter Bootstrap Pagination Theme:

We include a customized renderer if you are working with Twitter bootstrap, just:

require 'roda/will_paginate/bootstrap_pagination_renderer'

in you application and then specify the renderer to Will Paginate:

<%= will_paginate @collection, renderer: :bootstrap %>


<%= will_paginate @collection, renderer: Roda::WillPaginate::BootstrapPaginationRenderer %>

Alternative you can set it in the plugin configuration to avoid repeating it in each helper call:

plugin :will_paginate, renderer: :bootstrap


plugin :will_paginate, renderer: Roda::WillPaginate::BootstrapPaginationRenderer

Custom renderers

Please take a look at the Will Paginate docs to see how renderers work.

If you have a custom renderer named Foo you can namespace it inside Roda::WillPaginate::FooRenderer and then use the symbol :foo to refer to it. For example:

plugin :will_paginate, renderer: :foo


  1. Fork it ( )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request
You can’t perform that action at this time.