Module: Reporta::Column

Extended by:
ActiveSupport::Concern
Included in:
Reportable
Defined in:
lib/reporta/models/column.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#value_for(record, column_name) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/reporta/models/column.rb', line 41

def value_for(record, column_name)
  column = columns[column_name]

  # Local method defined that matches the column name
  if respond_to? column_name
    self.send column_name, record

  # Column has the data_chain option set
  elsif column.data_chain
    data_chain_result(record, column.data_chain)

  # Call the column name method on the record
  else
    record.send column_name
  end
end