Module: Fetcha::ClassMethods::PaginationTotalCount
- Defined in:
- lib/fetcha.rb
Instance Method Summary collapse
Instance Method Details
#reset ⇒ Object
24 25 26 27 |
# File 'lib/fetcha.rb', line 24 def reset @total_count = nil super end |
#total_count(column_name = :all, _options = nil) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/fetcha.rb', line 29 def total_count(column_name = :all, = 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 |