Methods

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.