Module: ActiveScaffold::Bridges::Bitfields::ListColumnHelpers

Defined in:
lib/active_scaffold/bridges/bitfields/list_ui.rb

Instance Method Summary collapse

Instance Method Details

#format_column_value(record, column, value = nil) ⇒ Object


5
6
7
8
9
10
11
12
# File 'lib/active_scaffold/bridges/bitfields/list_ui.rb', line 5

def format_column_value(record, column, value = nil)
  if record.class.respond_to?(:bitfields) && record.class.bitfields&.include?(column.name)
    value = record.bitfield_values(column.name).select { |_, v| v }.keys
    safe_join active_scaffold_config.columns.select { |c| c.name.in? value }.map(&:label), ', '
  else
    super
  end
end