Method: Tableview::ViewHandler::Table#column
- Defined in:
- lib/tableview/view_handler.rb
#column(title, opts = {}, header_opts = {}, row_opts = {}, &block) ⇒ Object
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/tableview/view_handler.rb', line 85 def column(title, opts = {}, header_opts = {}, row_opts = {}, &block) if title.is_a? Symbol method = title unless block_given? title = I18n.translate("activerecord.attributes.#{@collection.klass.name.downcase}.#{title}") end if block_given? proc = block#lambda { |val| block.call(val) } else proc = lambda { |val| val.send(method) } end @headers << Cell.new(title, opts.merge(header_opts)) @procs << proc @column_based = true end |