Class: Einvoice::Neweb::Validator::CarrierId2Validator

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



30
31
32
33
34
# File 'lib/einvoice/neweb/validator/invoice_validator.rb', line 30

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