Module: PaginationHelper::ClassMethods

Defined in:
app/helpers/pagination_helper.rb

Overview

These methods become class methods on any controller which includes PaginationHelper.

Instance Method Summary collapse

Instance Method Details

#paginate(collection_id, options = {}) ⇒ Object

Creates a before_filter which automatically paginates an Active Record model for all actions in a controller (or certain actions if specified with the :actions option).

options are the same as PaginationHelper#paginate, with the addition of:

:actions

an array of actions for which the pagination is active. Defaults to nil (i.e., every action).


193
194
195
196
197
198
199
200
# File 'app/helpers/pagination_helper.rb', line 193

def paginate(collection_id, options={})
  PaginationHelper.validate_options!(collection_id, options, false)
  module_eval do
    before_filter :create_paginators_and_retrieve_collections
    OPTIONS[self] ||= Hash.new
    OPTIONS[self][collection_id] = options
  end
end