Class: ATDIS::Validators::HttpUrlValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- ATDIS::Validators::HttpUrlValidator
- Defined in:
- lib/atdis/validators.rb
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/atdis/validators.rb', line 26 def validate_each(record, attribute, value) raw_value = record.send("#{attribute}_before_type_cast") if raw_value.present? && !value.kind_of?(URI::HTTP) && !value.kind_of?(URI::HTTPS) = "is not a valid URL" = ErrorMessage[, [:spec_section]] if [:spec_section] record.errors.add(attribute, ) end end |