Sha256: 6911ab639f460f2a36f2433b0808f573f0aedc06d5c0efa0dbce954edb3b3d39

Contents?: true

Size: 1004 Bytes

Versions: 111

Compression:

Stored size: 1004 Bytes

Contents

module Katello
  class ContentViewPackageFilterRule < Katello::Model
    include ::Katello::Concerns::ContentViewFilterRuleCommon

    belongs_to :filter,
               :class_name => "Katello::ContentViewPackageFilter",
               :inverse_of => :package_rules,
               :foreign_key => :content_view_filter_id

    validates :name, :presence => true
    validate :ensure_unique_attributes
    validates_with Validators::ContentViewFilterVersionValidator

    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)
      other = other.where.not(:id => self.id) if self.id
      if other.exists?
        errors.add(:base, "This package filter rule already exists.")
      end
    end
  end
end

Version data entries

111 entries across 111 versions & 1 rubygems

Version Path
katello-3.7.0.rc1 app/models/katello/content_view_package_filter_rule.rb
katello-3.5.2 app/models/katello/content_view_package_filter_rule.rb
katello-3.6.0 app/models/katello/content_view_package_filter_rule.rb
katello-3.6.0.1.rc2 app/models/katello/content_view_package_filter_rule.rb
katello-3.6.0.rc2 app/models/katello/content_view_package_filter_rule.rb
katello-3.6.0.rc1 app/models/katello/content_view_package_filter_rule.rb
katello-3.5.1.1 app/models/katello/content_view_package_filter_rule.rb
katello-3.5.1 app/models/katello/content_view_package_filter_rule.rb
katello-3.5.0.1 app/models/katello/content_view_package_filter_rule.rb
katello-3.5.0 app/models/katello/content_view_package_filter_rule.rb
katello-3.5.0.rc2 app/models/katello/content_view_package_filter_rule.rb