Module: Tabletastic::Helper

Defined in:
lib/tabletastic/helper.rb

Instance Method Summary collapse

Instance Method Details

#table_for(collection, *args, &block) ⇒ Object

returns and outputs a table for the given active record collection



4
5
6
7
8
9
10
11
# File 'lib/tabletastic/helper.rb', line 4

def table_for(collection, *args, &block)
  block = Tabletastic.default_table_block unless block_given?
  klass = default_class_for(collection)
  options = args.extract_options!
  initialize_html_options(options, klass)
  result = capture { block.call(TableBuilder.new(collection, klass, self)) }
  (:table, result, options[:html])
end