mislav/will_paginate — pull request #193 by dbackeus (2011-10-24 11:46:11+00:00)
Title: Mongoid support

This allows using `require 'will_paginate/mongoid'` to make use of Mongoids limit and skip methods when calling `paginate` rather than having to use the array extension.

I tried making the simplest implementation that could possibly work. After having a look at collection.rb I basically implemented whatever actions were mentioned at the top of the file for compatibility.

Rather than wrapping the query results in a WillPaginate::Collection object I extend any objects passing through Mongoid::Criteria.paginate with the collection methods. I thought it best to keep the funcionality of the criteria intact even after pagination. So it's a duck typed design.

I noticed there were classes for PerPage and PageNumber etc but I didn't understand the reason for them and everything worked fine in my app using Integers.

If you want to include this pull request as a starting point for Mongoid support i will_paginate I would be willing to put in some extra work in case you find there are rough edges or things that have to be improved.