Skip to content

Instantly share code, notes, and snippets.

@rust
Created December 22, 2011 07:24
Show Gist options
  • Select an option

  • Save rust/1509352 to your computer and use it in GitHub Desktop.

Select an option

Save rust/1509352 to your computer and use it in GitHub Desktop.
lib/kaminari_patch.rb
= paginator.render do
%div
= prev_page_tag
= (current_page.to_i - 1) * per_page + 1
\-
= [current_page.to_i * per_page, total_count].min
\/
= total_count
= next_page_tag
module Kaminari
module ActionViewExtension
def paginate(scope, options = {}, &block)
paginator = Kaminari::Helpers::Paginator.new self, options.reverse_merge(:current_page => scope.current_page, :num_pages => scope.num_pages, :per_page => scope.limit_value, :param_name => Kaminari.config.param_name, :remote => false, :total_count => scope.total_count)
paginator.to_s
end
end
end
@cthurst
Copy link
Copy Markdown

cthurst commented May 17, 2012

Thanks for this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment