Class: Katello::Validators::KatelloURLFormatValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- Katello::Validators::KatelloURLFormatValidator
- Includes:
- KatelloURLHelper
- Defined in:
- app/lib/katello/validators/katello_url_format_validator.rb
Constant Summary
Constants included from KatelloURLHelper
KatelloURLHelper::CONSTANTS_DEFINED, KatelloURLHelper::FILEPREFIX, KatelloURLHelper::PROTOCOLS
Instance Method Summary collapse
Methods included from KatelloURLHelper
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'app/lib/katello/validators/katello_url_format_validator.rb', line 6 def validate_each(record, attribute, value) if [:nil_allowed] if [:nil_allowed].respond_to?(:call) return if value.nil? && [:nil_allowed].call(record) else return if value.nil? end end attribute_name = [:field_name] || attribute record.errors.add(attribute_name, N_("is invalid")) unless kurl_valid?(value) end |