Class: Katello::Validators::GeneratedContentViewValidator

Inherits:
ActiveModel::Validator
  • Object
show all
Defined in:
app/lib/katello/validators/generated_content_view_validator.rb

Instance Method Summary collapse

Instance Method Details

#validate(record) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'app/lib/katello/validators/generated_content_view_validator.rb', line 4

def validate(record)
  record.content_view_environments.each do |cve|
    if cve.content_view_id
      view = ContentView.where(:id => cve.content_view_id).first
      if view&.generated_for_repository?
        record.errors[:base] << _("Content view '%{cv_name}' is a generated content view, which cannot be assigned to hosts or activation keys.") % { :cv_name => view.name }
      end
    end
  end
end