4
5
6
7
8
9
10
11
12
|
# File 'app/lib/katello/validators/alternate_content_source_products_validator.rb', line 4
def validate_each(record, attribute, value)
if value && (attribute == :product_id)
product = ::Katello::Product.find(value)
content_type = record.alternate_content_source.content_type
if product.acs_compatible_repositories.with_type(content_type).empty?
record.errors.add(attribute, _("%{name} has no %{type} repositories with upstream URLs to add to the alternate content source.") % { name: product.name, type: content_type })
end
end
end
|