Skip to content
Nick Dainty edited this page Nov 22, 2013 · 4 revisions

Bootstrap pagination as default renderer

Overwrite the will_paginate method in your application helper, so you do not have to always explicitly set the renderer to Bootstrap:

module ApplicationHelper
  # Always use the Twitter Bootstrap pagination renderer
  def will_paginate(collection_or_options = nil, options = {})
    if collection_or_options.is_a? Hash
      options, collection_or_options = collection_or_options, nil
    end
    unless options[:renderer]
      options = options.merge :renderer => BootstrapPagination::Rails
    end
    super *[collection_or_options, options].compact
  end
end

Thanks lawitschka for contributing the code above.

Clone this wiki locally