Skip to content

Commit

Permalink
Merge pull request #571 from rgaufman/master
Browse files Browse the repository at this point in the history
Add total_entries support for Mongoid

Fixes #570
  • Loading branch information
mislav committed Oct 9, 2019
2 parents 1437d5e + 66f3a42 commit 0c89db6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/will_paginate/mongoid.rb
Expand Up @@ -8,6 +8,8 @@ def paginate(options = {})
extend CollectionMethods
@current_page = WillPaginate::PageNumber(options[:page] || @current_page || 1)
@page_multiplier = current_page - 1
@total_entries = options.delete(:total_entries)

pp = (options[:per_page] || per_page || WillPaginate.per_page).to_i
limit(pp).skip(@page_multiplier * pp)
end
Expand Down

0 comments on commit 0c89db6

Please sign in to comment.