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:
parent
c34c557d97
commit
062c60344b
1 changed files with 3 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue