Class: ActiveModel::Validations::ValidSpanishVatValidator

Inherits:
EachValidator
  • Object
show all
Includes:
SpanishVatValidatorsHelpers
Defined in:
lib/spanish_vat_validators.rb

Overview

Validates any Spanish VAT number

Instance Method Summary collapse

Methods included from SpanishVatValidatorsHelpers

#message, #validate_cif, #validate_nie, #validate_nif

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



69
70
71
# File 'lib/spanish_vat_validators.rb', line 69

def validate_each(record, attribute, value)
  record.errors[attribute] = message unless validate_nif(value) or validate_cif(value) or validate_nie(value)
end