Project

General

Profile

« Previous | Next » 

Revision e085574c

Added by Brad Buckingham about 10 years ago

fixes #4773 - Content Views: fix issue which did not allow for multiple errata ids per filter

The erratum filter rule 'types' is a serialized array. The scope
that was placed on the model was incorrectly looking for 'nil';
however, with a serialized type, we really need to fetch the records
to look at the value of 'types', as the value for an existing
rule will not be 'nil', even when types is not specified.

View differences:

app/models/katello/content_view_erratum_filter_rule.rb
validates :errata_id, :uniqueness => { :scope => :content_view_filter_id }, :allow_blank => true
validates_with Validators::ContentViewErratumFilterRuleValidator
scope :with_date_or_type, where('start_date is not NULL or end_date is not NULL or types is not NULL')
def filter_has_date_or_type_rule?
filter.erratum_rules.any?{ |rule| rule.start_date || rule.end_date || !rule.types.blank? }
end
end
end

Also available in: Unified diff