Class: IcoValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- IcoValidator
- Defined in:
- app/validators/ico_validator.rb
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
2 3 4 5 6 |
# File 'app/validators/ico_validator.rb', line 2 def validate_each(record, attribute, value) unless !value.nil? && value =~ /\A\d{7,9}\z/ record.errors.add(attribute, ([:message] || :ico_format)) end end |