Sha256: 2f3733c4fdbbf65c590203407aefcddf12fb344a6ccd154255cbe3d1c311e1ac

Contents?: true

Size: 483 Bytes

Versions: 3

Compression:

Stored size: 483 Bytes

Contents

module PaginatedTable
  module ControllerHelpers
    def paginated_table(tables)
      raise ArgumentError if tables.length > 1
      name, collection = tables.first
      page = PageParams.create_page_from_params(params)
      data_page = DataPage.new(collection, page)
      instance_variable_set(:"@#{name}", data_page)
      render :partial => name.to_s, :layout => false if request.xhr?
    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.3 lib/paginated_table/controller_helpers.rb
paginated_table-0.0.2 lib/paginated_table/controller_helpers.rb
paginated_table-0.0.1 lib/paginated_table/controller_helpers.rb