Sha256: d575af91c55b6cd0f73d7b052477b9ceddf82be47a4b8cb1ec7b97fcbbbea516

Contents?: true

Size: 655 Bytes

Versions: 3

Compression:

Stored size: 655 Bytes

Contents

# encoding: UTF-8
module MongoMapper
  module Plugins
    module Pagination
      module ClassMethods
        def per_page
          25
        end

        def paginate(options)
          per_page      = options.delete(:per_page) || self.per_page
          page          = options.delete(:page)
          total_entries = count(options)
          pagination    = Pagination::Proxy.new(total_entries, page, per_page)

          options.update(:limit => pagination.limit, :skip => pagination.skip)
          pagination.subject = find_many(options)
          pagination
        end
      end
    end
  end
end

require 'mongo_mapper/plugins/pagination/proxy'

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
mongo_mapper_ign-0.7.7 lib/mongo_mapper/plugins/pagination.rb
pwnash-mongo_mapper-0.7.6 lib/mongo_mapper/plugins/pagination.rb
mongo_mapper_ign-0.7.6 lib/mongo_mapper/plugins/pagination.rb