4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/dont_you_count/kaminari.rb', line 4
def total_count(column_name = :all, options = {})
if ActiveAdmin.application.dont_count.include?(entry_name)
2000000
else
@total_count ||= begin
c = except(:offset, :limit, :order)
c = c.except(:includes) unless references_eager_loaded_tables?
args = [column_name]
args << options if ActiveRecord::VERSION::STRING < '4.1.0'
c = c.count(*args)
if c.is_a?(Hash) || c.is_a?(ActiveSupport::OrderedHash)
c.count
else
c.respond_to?(:count) ? c.count(*args) : c
end
end
end
end
|