module Fetcha::ClassMethods::PaginationTotalCount
Public Instance Methods
reset()
click to toggle source
Calls superclass method
# File lib/fetcha.rb, line 24 def reset @total_count = nil super end
total_count(column_name = :all, _options = nil)
click to toggle source
# File lib/fetcha.rb, line 29 def total_count(column_name = :all, _options = nil) @total_count ||= begin c = except(:offset, :limit, :order) c = c.count(column_name) if c.is_a?(Hash) || c.is_a?(ActiveSupport::OrderedHash) c.count else c.respond_to?(:count) ? c.count(column_name) : c end end end