Module WillPaginate::ActionView
In: lib/will_paginate/view_helpers/action_view.rb

ActionView helpers

This module serves for availability in ActionView templates. It also adds a new view helper: paginated_section.

Using the helper without arguments

If the helper is called without passing in the collection object, it will try to read from the instance variable inferred by the controller name. For example, calling will_paginate while the current controller is PostsController will result in trying to read from the @posts variable. Example:

  <%= will_paginate :id => true %>

… will result in @post collection getting paginated:

  <div class="pagination" id="posts_pagination"> ... </div>

Methods

Included Modules

ViewHelpers

Classes and Modules

Class WillPaginate::ActionView::LinkRenderer

Public Instance methods

Wrapper for rendering pagination links at both top and bottom of a block of content.

  <% paginated_section @posts do %>
    <ol id="posts">
      <% for post in @posts %>
        <li> ... </li>
      <% end %>
    </ol>
  <% end %>

will result in:

  <div class="pagination"> ... </div>
  <ol id="posts">
    ...
  </ol>
  <div class="pagination"> ... </div>

Arguments are passed to a will_paginate call, so the same options apply. Don‘t use the :id option; otherwise you‘ll finish with two blocks of pagination links sharing the same ID (which is invalid HTML).

Protected Instance methods

[Validate]