Created
December 22, 2011 07:24
-
-
Save rust/1509352 to your computer and use it in GitHub Desktop.
lib/kaminari_patch.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
= 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ugh. I haven't noticed that people need total_count in views, but yes, probably that's kaminari's fault.
Feel free to raise an issue or PR if you need to put that feature in kaminari core. Thank you!