Class: CsvRowModel::Validators::ValidateAttributes::AttributeValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/csv_row_model/validators/validate_attributes.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



8
9
10
11
# File 'lib/csv_row_model/validators/validate_attributes.rb', line 8

def validate_each(record, attribute, value)
  return unless value && (record.try(:using_warnings?) ? value.unsafe? : value.invalid?)
  record.errors.add(attribute)
end