Sha256: bd82dbb57af9e6b03ab7fdddb5adb6727f090b138606612b01d49f3e19c777fa
Contents?: true
Size: 1.28 KB
Versions: 17
Compression:
Stored size: 1.28 KB
Contents
module Katello class ContentViewErratumFilterRule < Katello::Model self.include_root_in_json = false before_create :default_types ISSUED = "issued".freeze UPDATED = "updated".freeze DATE_TYPES = [ISSUED, UPDATED].freeze belongs_to :filter, :class_name => "Katello::ContentViewErratumFilter", :inverse_of => :erratum_rules, :foreign_key => :content_view_filter_id serialize :types, Array validates_lengths_from_database validates :errata_id, :uniqueness => { :scope => :content_view_filter_id }, :allow_blank => true validates_with Validators::ContentViewErratumFilterRuleValidator validates :date_type, :if => proc { |o| o.start_date || o.end_date }, :inclusion => { :in => DATE_TYPES, :allow_blank => false, :message => (_("must be one of the following: %s") % DATE_TYPES.join(', ')) } def filter_has_date_or_type_rule? filter.erratum_rules.any? { |rule| rule.start_date || rule.end_date || !rule.types.blank? } end def pulp_date_type self.date_type == ISSUED ? "issued" : "updated" end def default_types if errata_id.nil? && types.blank? self.types = ContentViewErratumFilter::ERRATA_TYPES.keys end end end end
Version data entries
17 entries across 17 versions & 1 rubygems