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/mongoid_extension.rb

27 lines
718 B
Ruby
Raw Permalink Normal View History

require 'kaminari/models/mongoid_criteria_methods'
2011-04-19 03:05:18 -04:00
2011-02-16 01:23:41 -05:00
module Kaminari
module MongoidExtension
module Document
extend ActiveSupport::Concern
include Kaminari::ConfigurationMethods
included do
2014-12-15 00:05:47 -05:00
scope Kaminari.config.page_method_name, Proc.new {|num|
limit(default_per_page).offset(default_per_page * ((num = num.to_i - 1) < 0 ? 0 : num))
2014-12-15 00:05:47 -05:00
} do
include Kaminari::MongoidCriteriaMethods
include Kaminari::PageScopeMethods
end
end
module ClassMethods
def inherited(kls)
super
kls.send(:include, Kaminari::MongoidExtension::Document.dup)
end
end if Mongoid::VERSION < '5.0.0'
end
2011-02-16 01:23:41 -05:00
end
end