Do not assign options that don't have to be special-cased

`scope.total_pages` is the only method that queries count SQL so only special-case it.
This commit is contained in:
Yuki Nishijima 2014-08-18 20:08:57 -07:00
parent c73c3b7c2e
commit 862076fd15
1 changed files with 2 additions and 5 deletions

View File

@ -15,12 +15,9 @@ module Kaminari
# * <tt>:remote</tt> - Ajax? (false by default)
# * <tt>:ANY_OTHER_VALUES</tt> - Any other hash key & values would be directly passed into each tag as :locals value.
def paginate(scope, options = {}, &block)
options[:current_page] ||= scope.current_page
options[:total_pages] ||= scope.total_pages
options[:per_page] ||= scope.limit_value
options[:remote] ||= false
options[:total_pages] ||= scope.total_pages
paginator = Kaminari::Helpers::Paginator.new self, options
paginator = Kaminari::Helpers::Paginator.new(self, options.reverse_merge(:current_page => scope.current_page, :per_page => scope.limit_value, :remote => false))
paginator.to_s
end