Class: Einvoice::Neweb::Validator::TotalAmountValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- Einvoice::Neweb::Validator::TotalAmountValidator
- Defined in:
- lib/einvoice/neweb/validator/invoice_validator.rb
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
46 47 48 49 50 |
# File 'lib/einvoice/neweb/validator/invoice_validator.rb', line 46 def validate_each(record, attribute, value) unless value != record.attributes.values_at("sales_amount", "free_tax_sales_amount", "zero_tax_sales_amount", "tax_amount").map(&:to_i).inject(&:+) record.errors.add attribute, [:message] || :invalid end end |