Class: ActiveModel::Validations::ValidCifValidator

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

Overview

Validates CIF number only

Instance Method Summary collapse

Methods included from SpanishVatValidatorsHelpers

#message, #validate_cif, #validate_nie, #validate_nif

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



93
94
95
# File 'lib/spanish_vat_validators.rb', line 93

def validate_each(record, attribute,value)
  record.errors[attribute] = message('cif') unless validate_cif(value)
end