1
0
Fork 0
mirror of https://github.com/kaminari/kaminari.git synced 2022-11-09 13:44:37 -05:00
kaminari--kaminari/lib/kaminari/models/mongo_mapper_extension.rb
Akira Matsuda 389e769b32 Revert "Drop support for MongoMapper."
This reverts commit 48fc4bd0f1.

We decided not to immediately drop these adapters support.
We'll deprecate them in 0.17.0, then remove them from core in 1.0.
2016-04-14 09:32:55 +09:00

18 lines
486 B
Ruby

require 'kaminari/models/plucky_criteria_methods'
module Kaminari
module MongoMapperExtension
module Document
extend ActiveSupport::Concern
include Kaminari::ConfigurationMethods
included do
# Fetch the values at the specified page number
# Model.page(5)
scope Kaminari.config.page_method_name, Proc.new {|num|
limit(default_per_page).offset(default_per_page * ([num.to_i, 1].max - 1))
}
end
end
end
end