Add support for mongoid max_scan option

respect the max_scan option in criteria

cache the total_count in the collection instance
prevent hitting db again in the same instance
Refactor #rel_next_prev_link_tags method

closes #501
Fix tests for Sinatra
Tweak spec for sinatra again
Merge pull request #500 from aptx4869/support-mongoid-max-scan

Add support for mongoid max_scan option
Add link_to_previous_page helper for sinatra
Merge pull request #504 from ikeay/fix_sinatra_previous_link

Add link_to_previous_page helper for sinatra
Add tests for mongoid 4 beta 1
Merge pull request #505 from arthurnn/mongoid4

Add tests for mongoid 4 beta 1
Do not test mongoid 4.0 with Ruby 1.8.7
Mongoid 4.0 with rubinius is still unstable so just allow it to fail

Also, AR edge with jruby has been stable for a while, so do not allow it
to fail.
Add documenttion for link_to_previous_page [ci skip]
Make helper methods for sinatra slightly better
Another small refactoring
Merge remote-tracking branch 'upstream/master'