diff --git a/lib/kaminari/models/active_record_relation_methods.rb b/lib/kaminari/models/active_record_relation_methods.rb index 362c12a..f8ceb5a 100644 --- a/lib/kaminari/models/active_record_relation_methods.rb +++ b/lib/kaminari/models/active_record_relation_methods.rb @@ -3,7 +3,9 @@ module Kaminari extend ActiveSupport::Concern module InstanceMethods def total_count #:nodoc: - except(:offset, :limit).count + c = except(:offset, :limit).count + # .group returns an OrderdHash that responds to #count + c.respond_to?(:count) ? c.count : c end end end