Class: IbanValidation::IbanValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/iban_validation/iban_validator.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, values) ⇒ Object



3
4
5
6
7
# File 'lib/iban_validation/iban_validator.rb', line 3

def validate_each(record, attribute, values)
  unless IBANTools::IBAN.valid? values
    record.errors.add attribute, :invalid
  end
end