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.0.0.rc2 app/lib/katello/validators/repository_unique_attribute_validator.rb
katello-3.0.0.rc1 app/lib/katello/validators/repository_unique_attribute_validator.rb
katello-2.4.1 app/lib/katello/validators/repository_unique_attribute_validator.rb
katello-2.4.0 app/lib/katello/validators/repository_unique_attribute_validator.rb
katello-2.4.0.rc3 app/lib/katello/validators/repository_unique_attribute_validator.rb
katello-2.4.0.rc2 app/lib/katello/validators/repository_unique_attribute_validator.rb
katello-2.4.0.rc1 app/lib/katello/validators/repository_unique_attribute_validator.rb