lib/plucky/query.rb in plucky-0.6.2 vs lib/plucky/query.rb in plucky-0.6.3

- old
+ new

@@ -51,11 +51,12 @@ end def paginate(opts={}) page = opts.delete(:page) limit = opts.delete(:per_page) || per_page + total_entries = opts.delete(:total_entries) query = clone.amend(opts) - paginator = Pagination::Paginator.new(query.count, page, limit) + paginator = Pagination::Paginator.new(total_entries || query.count, page, limit) docs = query.amend({ :limit => paginator.limit, :skip => paginator.skip, }).all