Class: Einvoice::Neweb::Validator::CarrierId1Validator

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



22
23
24
25
26
# File 'lib/einvoice/neweb/validator/invoice_validator.rb', line 22

def validate_each(record, attribute, value)
  if (record.print_mark.to_s == "Y" && value.present?) || (record.print_mark.to_s == "N" && value.blank?)
    record.errors.add attribute, options[:message] || :invalid
  end
end