Class: ModelAuditor::AttributeReaders::ArrayField

Inherits:
Associated
  • Object
show all
Defined in:
lib/model_auditor/attribute_readers/array_field.rb

Instance Attribute Summary

Attributes inherited from Associated

#key, #model

Instance Method Summary collapse

Methods inherited from Associated

#initialize

Constructor Details

This class inherits a constructor from ModelAuditor::AttributeReaders::Associated

Instance Method Details

#valueObject



6
7
8
9
10
11
# File 'lib/model_auditor/attribute_readers/array_field.rb', line 6

def value
  return unless method_name

  values = model.send(method_name).map { |i| i.try(:title) }
  values.join(', ') if values.try(:all?)
end