use fast count in post paginator

This commit is contained in:
albert
2013-01-06 13:43:11 -05:00
parent 4a5728e770
commit a344fdbfe6
2 changed files with 6 additions and 2 deletions

View File

@@ -6,7 +6,9 @@ module Danbooru
extend ActiveSupport::Concern
module ClassMethods
def paginate(page)
def paginate(page, options = {})
@paginator_options = options
if use_sequential_paginator?(page)
paginate_sequential(page)
else
@@ -69,6 +71,8 @@ module Danbooru
# taken from kaminari (https://github.com/amatsuda/kaminari)
def total_count
return @paginator_options[:count] if @paginator_options[:count]
c = except(:offset, :limit, :order)
c = c.reorder(nil)
c = c.count