Class: ATDIS::Validators::ArrayHttpUrlValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- ATDIS::Validators::ArrayHttpUrlValidator
- Defined in:
- lib/atdis/validators.rb
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'lib/atdis/validators.rb', line 39 def validate_each(record, attribute, value) if value.present? && value.is_a?(Array) && value.any? { |v| !v.is_a?(URI::HTTP) && !v.is_a?(URI::HTTPS) } = "contains an invalid URL" = ErrorMessage[, [:spec_section]] if [:spec_section] record.errors.add(attribute, ) end end |