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

fixes #21 ensure total_count returns a number

Model.group.count does not return a Fixnum but an OrderdHash
This commit is contained in:
Akira Matsuda 2011-02-22 22:18:14 +09:00
parent c34c557d97
commit 062c60344b

View file

@ -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