Sha256: 3189e7bc531ce7709b4dfe836df0dac28b47e6a621b4e67991f41aee3badc732

Contents?: true

Size: 459 Bytes

Versions: 2

Compression:

Stored size: 459 Bytes

Contents

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 :page, Proc.new {|num|
          limit(default_per_page).offset(default_per_page * ([num.to_i, 1].max - 1))
        }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wulffeld_kaminari-0.12.4.2 lib/kaminari/models/mongo_mapper_extension.rb
wulffeld_kaminari-0.12.4.1 lib/kaminari/models/mongo_mapper_extension.rb