module Folio::WillPaginate::ActiveRecord::Pagination

Public Instance Methods

build_page() click to toggle source
# File lib/folio/will_paginate/active_record.rb, line 48
def build_page
  Folio::Ordinal::Page.create
end
default_per_page() click to toggle source

don’t try and look at Class (ActiveRecord::Base.class, etc.) for defaults

# File lib/folio/will_paginate/active_record.rb, line 60
def default_per_page
  Folio.per_page
end
fill_page(page) click to toggle source

load the results and place them in the page

# File lib/folio/will_paginate/active_record.rb, line 53
def fill_page(page)
  page.replace self.find(:all, offset: page.offset, limit: page.per_page)
  page
end
paginate_with_wp_count(options={}) click to toggle source
# File lib/folio/will_paginate/active_record.rb, line 37
def paginate_with_wp_count(options={})
  unless options.has_key?(:total_entries)
    page = (options.fetch(:page) { 1 }).to_i
    per_page = (options.fetch(:per_page) { self.per_page }).to_i
    offset = (page - 1) * per_page
    options[:total_entries] = wp_count({}, [:all, {offset: offset, limit: per_page}], 'find')
  end
  paginate_without_wp_count(options)
end