jnunemaker/plucky — pull request #31 by kylev (2013-01-14 20:14:32+00:00)
Title: Allow a paginate query to override the total_entries

When using other parts of the Ruby ecosystem (like will_paginate) I've found it useful to be able to override the supposed number of elements in a paginated query. This is especially useful when the count operation is expensive and I want to use a counter cache equivalent.

This patch allows users to pass in a :total_entries option to paginate in order to override the count behavior if they have domain-local knowledge about the count and are willing to accept the risk/inconsistency inherent such optimizations.

This is more general than [other monkey patches out there](http://www.coffeepowered.net/2011/07/17/mongodb-count-and-the-big-o/) and uses an option name familiar to those who use will_paginate.