Sha256: d5874c99fa69df11cf4165b780358aaa79805c451085baed8478e76073abea82

Contents?: true

Size: 688 Bytes

Versions: 7

Compression:

Stored size: 688 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
    end
  end
end

Version data entries

7 entries across 7 versions & 5 rubygems

Version Path
ish_lib_manager-0.0.1 test/dummy/vendor/bundle/ruby/2.3.0/gems/kaminari-0.16.3/lib/kaminari/models/mongoid_extension.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/kaminari-0.16.3/lib/kaminari/models/mongoid_extension.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/kaminari-0.16.3/lib/kaminari/models/mongoid_extension.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/kaminari-0.16.3/lib/kaminari/models/mongoid_extension.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/kaminari-0.16.3/lib/kaminari/models/mongoid_extension.rb
shoppe-paypal-1.1.0 vendor/bundle/ruby/2.1.0/gems/kaminari-0.16.3/lib/kaminari/models/mongoid_extension.rb
kaminari-0.16.3 lib/kaminari/models/mongoid_extension.rb