Module: WillPaginate::DataMapper::Pagination

### Home Classes Methods

### In Files

- lib/will_paginate/data_mapper.rb

### Methods

- #page
- #paginate

### Class/Module Index

Quicksearch

- WillPaginate
- WillPaginate::ActionView
- WillPaginate::ActionView::LinkRenderer
- WillPaginate::ActiveRecord
- WillPaginate::ActiveRecord::BaseMethods
- WillPaginate::ActiveRecord::Pagination
- WillPaginate::ActiveRecord::RelationMethods
- WillPaginate::Collection
- WillPaginate::CollectionMethods
- WillPaginate::DataMapper
- WillPaginate::DataMapper::CollectionMethods
- WillPaginate::DataMapper::Pagination
- WillPaginate::Deprecation
- WillPaginate::Deprecation::Hash
- WillPaginate::I18n
- WillPaginate::InvalidPage
- WillPaginate::Merb
- WillPaginate::Merb::LinkRenderer
- WillPaginate::PageNumber
- WillPaginate::PerPage
- WillPaginate::PerPage::Inheritance
- WillPaginate::Railtie
- WillPaginate::Railtie::ControllerRescuePatch
- WillPaginate::Railtie::ShowExceptionsPatch
- WillPaginate::SequelMethods
- WillPaginate::Sinatra
- WillPaginate::Sinatra::Helpers
- WillPaginate::Sinatra::LinkRenderer
- WillPaginate::ViewHelpers
- WillPaginate::ViewHelpers::LinkRenderer
- WillPaginate::ViewHelpers::LinkRendererBase
- Array
- Object

No matching classes.

# WillPaginate::DataMapper::Pagination

### Public Instance Methods

page(num) click to toggle source

    # File lib/will_paginate/data_mapper.rb, line 10
    def page(num)
      pagenum = ::WillPaginate::PageNumber(num.nil? ? 1 : num)
      per_page = query.limit || self.per_page
      options = {:offset => pagenum.to_offset(per_page).to_i}
      options[:limit] = per_page unless query.limit
      col = new_collection(query.merge(options))
      col.current_page = pagenum
      col
    end

paginate(options) click to toggle source

    # File lib/will_paginate/data_mapper.rb, line 20
    def paginate(options)
      options  = options.dup
      pagenum  = options.fetch(:page) { raise ArgumentError, ":page parameter required" }
      per_page = options.delete(:per_page) || self.per_page

      options.delete(:page)
      options[:limit] = per_page.to_i

      all(options).page(pagenum)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.