1
0
Fork 0
mirror of https://github.com/kaminari/kaminari.git synced 2022-11-09 13:44:37 -05:00

Remove workaround now that total_count allows options passthrough

This commit is contained in:
Ben Simpson 2012-05-04 14:54:22 -04:00 committed by Ben Simpson
parent 83b1ff13e3
commit 8e0d22b0da

View file

@ -16,11 +16,6 @@ module Kaminari
# Remove includes only if they are irrelevant
c = c.except(:includes) unless references_eager_loaded_tables?
# a workaround to count the actual model instances on distinct query because count + distinct returns wrong value in some cases. see https://github.com/amatsuda/kaminari/pull/160
uses_distinct_sql_statement = c.to_sql =~ /DISTINCT/i
if uses_distinct_sql_statement
c.length
else
# .group returns an OrderdHash that responds to #count
c = c.count(column_name, options)
c.respond_to?(:count) ? c.count(column_name, options) : c
@ -28,4 +23,3 @@ module Kaminari
end
end
end
end