Class: VatNumberValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/vat_number_validator.rb,
lib/vat_number_validator/errors.rb,
lib/vat_number_validator/configuration.rb

Defined Under Namespace

Classes: APIError, Configuration

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



7
8
9
10
11
# File 'lib/vat_number_validator.rb', line 7

def validate_each(record, attribute, value)
  unless valid?(value)
    record.errors.add(attribute, :incorrect_vat_number_format)
  end
end