From b2221f7b1955067831453fc33d8928e8a6478671 Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Sun, 10 Nov 2013 08:02:49 +0900 Subject: [PATCH] AR 3.0: call the original count method if :distinct option was given fixes #453 --- lib/kaminari/models/active_record_relation_methods.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/kaminari/models/active_record_relation_methods.rb b/lib/kaminari/models/active_record_relation_methods.rb index 3cbe842..d483ad5 100644 --- a/lib/kaminari/models/active_record_relation_methods.rb +++ b/lib/kaminari/models/active_record_relation_methods.rb @@ -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