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[attribute_name] << N_("is invalid") unless kurl_valid?(value) end |