class SecurityIdentifiers::Validations::IsinValidator

Public Instance Methods

validate_each(record, attribute, value) click to toggle source
# File lib/security_identifiers/validations/isin_validator.rb, line 4
def validate_each(record, attribute, value)
  isin = ISIN.new(value)

  record.errors[attribute] << 'does not have a valid check digit' unless isin.valid?
rescue SecurityIdentifiers::InvalidFormat
  record.errors[attribute] << 'is not in the correct format'
end