AR 3.0: call the original count method if :distinct option was given

fixes #453
This commit is contained in:
Akira Matsuda 2013-11-10 08:02:49 +09:00
parent 7c228ff673
commit b2221f7b19
1 changed files with 1 additions and 1 deletions

View File

@ -4,7 +4,7 @@ module Kaminari
# if +limit_value+ is specified, load all the records and count them
if ActiveRecord::VERSION::STRING < '3.1'
def count(column_name = nil, options = {}) #:nodoc:
limit_value ? length : super(column_name, options)
limit_value && !options[:distinct] ? length : super(column_name, options)
end
end