Sha256: 040461c60aac500cb2cb6cacdebd542a4549e630f62f1e9704e30fc62e481362

Contents?: true

Size: 718 Bytes

Versions: 2

Compression:

Stored size: 718 Bytes

Contents

require 'kaminari/models/mongoid_criteria_methods'

module Kaminari
  module MongoidExtension
    module Document
      extend ActiveSupport::Concern
      include Kaminari::ConfigurationMethods

      included do
        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))
        } 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
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/kaminari-0.17.0/lib/kaminari/models/mongoid_extension.rb
kaminari-0.17.0 lib/kaminari/models/mongoid_extension.rb