Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Paginate without the count for plucky. Probably doesn't work with will paginate, but if you just have previous / next it works great and avoids expensive count calls.
Plucky::Query.class_eval do
def paginate_without_total(opts={})
page = (opts.delete(:page) || 1).to_i
limit = (opts.delete(:per_page) || per_page).to_i
skip = (page - 1) * limit
all(opts.merge(:limit => limit, :skip => skip))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.