Class: Einvoice::Validator::Neweb::CarrierId1Validator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- Einvoice::Validator::Neweb::CarrierId1Validator
- Defined in:
- lib/einvoice/neweb/validator/carrier_id1_validator.rb
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
5 6 7 8 9 |
# File 'lib/einvoice/neweb/validator/carrier_id1_validator.rb', line 5 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, [:message] || :invalid end end |