Sha256: d00514ff37fc2af5964233398351871edd77bf182e41792591de2d5514b25d98

Contents?: true

Size: 586 Bytes

Versions: 245

Compression:

Stored size: 586 Bytes

Contents

module Katello
  module Validators
    class KatelloUrlFormatValidator < ActiveModel::EachValidator
      include KatelloUrlHelper

      def validate_each(record, attribute, value)
        if options[:nil_allowed]
          if options[:nil_allowed].respond_to?(:call)
            return if value.nil? && options[:nil_allowed].call(record)
          else
            return if value.nil?
          end
        end

        attribute_name = options[:field_name] || attribute
        record.errors[attribute_name] << N_("is invalid") unless kurl_valid?(value)
      end
    end
  end
end

Version data entries

245 entries across 245 versions & 1 rubygems

Version Path
katello-4.14.2 app/lib/katello/validators/katello_url_format_validator.rb
katello-4.14.1 app/lib/katello/validators/katello_url_format_validator.rb
katello-4.14.0 app/lib/katello/validators/katello_url_format_validator.rb
katello-4.14.0.rc3 app/lib/katello/validators/katello_url_format_validator.rb
katello-4.14.0.rc2 app/lib/katello/validators/katello_url_format_validator.rb
katello-4.14.0.rc1.1 app/lib/katello/validators/katello_url_format_validator.rb
katello-4.14.0.rc1 app/lib/katello/validators/katello_url_format_validator.rb
katello-4.13.1 app/lib/katello/validators/katello_url_format_validator.rb
katello-4.13.0 app/lib/katello/validators/katello_url_format_validator.rb
katello-4.12.1 app/lib/katello/validators/katello_url_format_validator.rb
katello-4.13.0.rc1 app/lib/katello/validators/katello_url_format_validator.rb
katello-4.12.0 app/lib/katello/validators/katello_url_format_validator.rb
katello-4.12.0.rc3 app/lib/katello/validators/katello_url_format_validator.rb
katello-4.12.0.rc2 app/lib/katello/validators/katello_url_format_validator.rb
katello-4.12.0.rc1 app/lib/katello/validators/katello_url_format_validator.rb
katello-4.11.1 app/lib/katello/validators/katello_url_format_validator.rb
katello-4.11.0 app/lib/katello/validators/katello_url_format_validator.rb
katello-4.11.0.rc2 app/lib/katello/validators/katello_url_format_validator.rb
katello-4.11.0.rc1 app/lib/katello/validators/katello_url_format_validator.rb
katello-4.10.0 app/lib/katello/validators/katello_url_format_validator.rb