Sha256: 2dc2018104e950255b4c40aab0035e19191513d5b2042bf50df1488228458d81

Contents?: true

Size: 1.29 KB

Versions: 42

Compression:

Stored size: 1.29 KB

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
    scoped_search :on => :version, :complete_value => true
    scoped_search :on => :min_version, :complete_value => true
    scoped_search :on => :max_version, :complete_value => true
    scoped_search :on => :architecture, :complete_value => true

    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
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
katello-4.8.4 app/models/katello/content_view_package_filter_rule.rb
katello-4.8.3 app/models/katello/content_view_package_filter_rule.rb
katello-4.7.6 app/models/katello/content_view_package_filter_rule.rb
katello-4.8.2 app/models/katello/content_view_package_filter_rule.rb
katello-4.8.1 app/models/katello/content_view_package_filter_rule.rb
katello-4.7.5 app/models/katello/content_view_package_filter_rule.rb
katello-4.8.0 app/models/katello/content_view_package_filter_rule.rb
katello-4.8.0.rc2 app/models/katello/content_view_package_filter_rule.rb
katello-4.7.4 app/models/katello/content_view_package_filter_rule.rb
katello-4.8.0.rc1 app/models/katello/content_view_package_filter_rule.rb
katello-4.7.3 app/models/katello/content_view_package_filter_rule.rb
katello-4.7.2 app/models/katello/content_view_package_filter_rule.rb
katello-4.7.1 app/models/katello/content_view_package_filter_rule.rb
katello-4.6.2.1 app/models/katello/content_view_package_filter_rule.rb
katello-4.6.2 app/models/katello/content_view_package_filter_rule.rb
katello-4.7.0 app/models/katello/content_view_package_filter_rule.rb
katello-4.6.1 app/models/katello/content_view_package_filter_rule.rb
katello-4.7.0.rc2 app/models/katello/content_view_package_filter_rule.rb
katello-4.7.0.rc1 app/models/katello/content_view_package_filter_rule.rb
katello-4.4.2.2 app/models/katello/content_view_package_filter_rule.rb