Class: Katello::ContentViewPackageFilterRule

Inherits:
Model
  • Object
show all
Includes:
Katello::Concerns::ContentViewFilterRuleCommon
Defined in:
app/models/katello/content_view_package_filter_rule.rb

Instance Method Summary collapse

Methods inherited from Model

#destroy!

Instance Method Details

#ensure_unique_attributesObject



18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/models/katello/content_view_package_filter_rule.rb', line 18

def ensure_unique_attributes
  other = self.class.where(:name => self.name,
                           :version => self.version,
                           :content_view_filter_id => self.content_view_filter_id,
                           :min_version => self.min_version,
                           :max_version => self.max_version,
                           :architecture => self.architecture)
  other = other.where.not(:id => self.id) if self.id
  if other.exists?
    errors.add(:base, "This package filter rule already exists.")
  end
end