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

use #length for any query using just DISTINCT instead of DISTINCT ON only

This commit is contained in:
Dennis Prochniak 2011-09-06 22:06:06 +02:00
parent 85c66a3066
commit 635f6a45ff

View file

@ -20,8 +20,8 @@ module Kaminari
# Remove includes only if they are irrelevant # Remove includes only if they are irrelevant
c = c.except(:includes) unless references_eager_loaded_tables? c = c.except(:includes) unless references_eager_loaded_tables?
uses_distinct_on_sql = c.to_sql =~ /DISTINCT ON/i uses_distinct_sql_statement = c.to_sql =~ /DISTINCT/i
if uses_distinct_on_sql if uses_distinct_sql_statement
return c.length return c.length
end end