Sha256: adb4560a468caada98c087a956b399030e5be31d3ed645c32ec1cd79e0c89f03

Contents?: true

Size: 530 Bytes

Versions: 3

Compression:

Stored size: 530 Bytes

Contents

module PaginatedTable
  module ControllerHelpers
    def paginated_table(name, collection, options = {})
      defaults = options.fetch(:defaults, {})
      page = PageParams.create_page(params, defaults)
      data_page = DataPage.new(collection, page)
      instance_variable_set(:"@#{name}", data_page)
      if request.xhr?
        partial = options.fetch(:partial, name)
        render :partial => partial, :layout => false
      end
    end
  end
end

ActionController::Base.send :include, PaginatedTable::ControllerHelpers

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
paginated_table-0.0.9 lib/paginated_table/controller_helpers.rb
paginated_table-0.0.8 lib/paginated_table/controller_helpers.rb
paginated_table-0.0.7 lib/paginated_table/controller_helpers.rb