Class: ActiveModel::Validations::AllowedSubdomainValidator
- Inherits:
-
EachValidator
- Object
- EachValidator
- ActiveModel::Validations::AllowedSubdomainValidator
- Defined in:
- lib/reserved_subdomains.rb
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/reserved_subdomains.rb', line 9 def validate_each(record, attribute, value) reserved = exists_in_reserved_list(value) regexp = matches_regexp_list(value) if value.present? && ( reserved || regexp) record.errors.add(attribute, :invalid) end end |