Class: Einvoice::Neweb::Validator::PrintMarkValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/einvoice/neweb/validator/invoice_validator.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



38
39
40
41
42
# File 'lib/einvoice/neweb/validator/invoice_validator.rb', line 38

def validate_each(record, attribute, value)
  if value == "Y" && (record.carrier_id1.present? || record.carrier_id2.present? || record.donate_mark == "Y")
    record.errors.add attribute, options[:message] || :invalid
  end
end