Method: TableFor::Base#cell_content

Defined in:
lib/table_for/base.rb

#cell_content(record, column, options = {}) ⇒ Object



85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/table_for/base.rb', line 85

def cell_content(record, column, options={})
  if options[:formatter]
    if options[:formatter].is_a?(Proc)
      call_with_params(options[:formatter], record.send(column.name), options)
    else
      record.send(column.name).try(*options[:formatter])
    end
  elsif options[:data] || [:edit, :show, :delete].include?(column.name)
    call_with_params(options[:data], record)
  else
    record.send(column.name)
  end
end