Class ActionController::Pagination::Paginator
In: lib/action_controller/pagination.rb
Parent: Object

A class representing a paginator for an Active Record collection.

Methods

Included Modules

Enumerable

Classes and Modules

Class ActionController::Pagination::Paginator::Page
Class ActionController::Pagination::Paginator::Window

Attributes

controller  [R] 
item_count  [R] 
items_per_page  [R] 

Public Class methods

Creates a new Paginator on the given controller for a set of items of size item_count and having items_per_page items per page. Raises ArgumentError if items_per_page is out of bounds (i.e., less than or equal to zero). The page CGI parameter for links defaults to "page" and can be overridden with page_parameter.

Public Instance methods

Returns a new Page representing the page with the given index number.

current()

Alias for current_page

Returns a Page object representing this paginator’s current page.

Sets the current page number of this paginator. If page is a Page object, its number attribute is used as the value; if the page does not belong to this Paginator, an ArgumentError is raised.

Successively yields all the paginator’s pages to the given block.

first()

Alias for first_page

Returns a new Page representing the first page in this paginator.

Returns true if this paginator contains the page of index number.

last()

Alias for last_page

Returns a new Page representing the last page in this paginator.

length()

Alias for page_count

Returns the number of pages in this paginator.

[Validate]