amatsuda/kaminari — pull request #590 by Zhomart (2014-08-14 03:06:35+00:00)
Title: MongoidCriteriaMethods#total_count uses :size instead of :count

Mongoid's `count` method always hits the database for the same queries, but `size` and `length` methods will not hit the database. It is useful when `query.size` is also called in application.

`Criteria#count`
Get a count of persisted documents. Note this will always hit the database for the count.

`Criteria#length`
Also `size`. Get a count of persisted documents. After being called once for the criteria, will cache subsequent calls and not hit the database.