Sha256: d4872d074308c061f6f8b08ac5a086cd701d6028bd31fe24d09e9f83c72204ce

Contents?: true

Size: 444 Bytes

Versions: 67

Compression:

Stored size: 444 Bytes

Contents

module Katello
  module Validators
    class RepositoryUniqueAttributeValidator < ActiveModel::EachValidator
      def validate_each(record, attribute, _value)
        unique = !record.exist_for_environment?(record.environment, record.content_view, attribute)

        if !unique && record.send("#{attribute}_changed?")
          record.errors[attribute] << _("has already been taken for this product.")
        end
      end
    end
  end
end

Version data entries

67 entries across 67 versions & 1 rubygems

Version Path
katello-3.8.1 app/lib/katello/validators/repository_unique_attribute_validator.rb
katello-3.7.1.1 app/lib/katello/validators/repository_unique_attribute_validator.rb
katello-3.7.1 app/lib/katello/validators/repository_unique_attribute_validator.rb
katello-3.8.0 app/lib/katello/validators/repository_unique_attribute_validator.rb
katello-3.8.0.rc3 app/lib/katello/validators/repository_unique_attribute_validator.rb
katello-3.8.0.rc2 app/lib/katello/validators/repository_unique_attribute_validator.rb
katello-3.7.0 app/lib/katello/validators/repository_unique_attribute_validator.rb
katello-3.8.0.rc1 app/lib/katello/validators/repository_unique_attribute_validator.rb
katello-3.7.0.rc2 app/lib/katello/validators/repository_unique_attribute_validator.rb
katello-3.7.0.rc1 app/lib/katello/validators/repository_unique_attribute_validator.rb
katello-3.5.2 app/lib/katello/validators/repository_unique_attribute_validator.rb
katello-3.6.0 app/lib/katello/validators/repository_unique_attribute_validator.rb
katello-3.6.0.1.rc2 app/lib/katello/validators/repository_unique_attribute_validator.rb
katello-3.6.0.rc2 app/lib/katello/validators/repository_unique_attribute_validator.rb
katello-3.6.0.rc1 app/lib/katello/validators/repository_unique_attribute_validator.rb
katello-3.5.1.1 app/lib/katello/validators/repository_unique_attribute_validator.rb
katello-3.5.1 app/lib/katello/validators/repository_unique_attribute_validator.rb
katello-3.5.0.1 app/lib/katello/validators/repository_unique_attribute_validator.rb
katello-3.5.0 app/lib/katello/validators/repository_unique_attribute_validator.rb
katello-3.5.0.rc2 app/lib/katello/validators/repository_unique_attribute_validator.rb