class Renderer::Association

Public Instance Methods

association?() click to toggle source
# File lib/tabulatr/renderer/association.rb, line 38
def association?() true end
coltype() click to toggle source
# File lib/tabulatr/renderer/association.rb, line 36
def coltype() 'association' end
column?() click to toggle source
# File lib/tabulatr/renderer/association.rb, line 37
def column?() false end
human_name() click to toggle source
# File lib/tabulatr/renderer/association.rb, line 25
def human_name
  h = col_options.header
  if h && h.respond_to?(:call)
    h.()
  elsif h
    h
  else
    klass.model_name.human + ' ' + klass.human_attribute_name(name)
  end
end
principal_value(record, view) click to toggle source
Calls superclass method Renderer::Column#principal_value
# File lib/tabulatr/renderer/association.rb, line 40
def principal_value(record, view)
  return super if output || block
  v = record.send(table_name)
  if v && v.respond_to?(:to_a) && name != :count
    v.map(&:"#{name}")
  else
    v.try(name)
  end
end