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