Sha256: 639d88eb00d67376e22e005fae3b8228a25f7290ee7787b351b3c58a9585de2d

Contents?: true

Size: 575 Bytes

Versions: 3

Compression:

Stored size: 575 Bytes

Contents

# frozen_string_literal: true
require 'kaminari/mongo_mapper/plucky_criteria_methods'

module Kaminari
  module MongoMapper
    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
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
kaminari-mongo_mapper-1.0.1 lib/kaminari/mongo_mapper/mongo_mapper_extension.rb
kaminari-mongo_mapper-1.0.0 lib/kaminari/mongo_mapper/mongo_mapper_extension.rb
kaminari-mongo_mapper-1.0.0.rc1 lib/kaminari/mongo_mapper/mongo_mapper_extension.rb