class RailsTableFor::Elements::FieldColumn

Attributes

field[R]
title[R]

Public Class Methods

new(field, **options) click to toggle source
# File lib/rails_table_for/elements/field_column.rb, line 16
def initialize(field, **options)
  raise('Field cannot be nil', ArgumentError) if field.nil?

  @field = field
  @title = options[:title] || field.to_s.humanize
  @auto_link_enabled = options[:auto_link] || false
end

Public Instance Methods

td(record) click to toggle source
# File lib/rails_table_for/elements/field_column.rb, line 24
def td(record)
  text = record.send(field)
  content = auto_link_enabled ? auto_link(record, text) : text
  content_tag :td, content
end