Class: SecurityIdentifiers::Validations::SedolValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- SecurityIdentifiers::Validations::SedolValidator
- Defined in:
- lib/security_identifiers/validations/sedol_validator.rb
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/security_identifiers/validations/sedol_validator.rb', line 7 def validate_each(record, attribute, value) begin sedol = SEDOL.new(value) unless sedol.valid? record.errors[attribute] << 'does not have a valid check digit' end rescue SecurityIdentifiers::InvalidFormat record.errors[attribute] << 'is not in the correct format' end end |