Module: Katello::Concerns::ContentFacetHostExtensions::ClassMethods
- Defined in:
- app/models/katello/concerns/content_facet_host_extensions.rb
Instance Method Summary collapse
- #find_by_applicable_errata(_key, operator, value) ⇒ Object
- #find_by_installable_errata(_key, operator, value) ⇒ Object
Instance Method Details
#find_by_applicable_errata(_key, operator, value) ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'app/models/katello/concerns/content_facet_host_extensions.rb', line 37 def find_by_applicable_errata(_key, operator, value) conditions = sanitize_sql_for_conditions(["#{Katello::Erratum.table_name}.errata_id #{operator} ?", value_to_sql(operator, value)]) hosts = ::Host::Managed.joins(:applicable_errata).where(conditions) if hosts.empty? { :conditions => "1=0" } else { :conditions => "#{::Host::Managed.table_name}.id IN (#{hosts.pluck(:id).join(',')})" } end end |
#find_by_installable_errata(_key, operator, value) ⇒ Object
47 48 49 50 51 52 53 54 55 |
# File 'app/models/katello/concerns/content_facet_host_extensions.rb', line 47 def find_by_installable_errata(_key, operator, value) conditions = sanitize_sql_for_conditions(["#{Katello::Erratum.table_name}.errata_id #{operator} ?", value_to_sql(operator, value)]) facets = Katello::Host::ContentFacet.joins_installable_errata.where(conditions) if facets.empty? { :conditions => "1=0" } else { :conditions => "#{::Host::Managed.table_name}.id IN (#{facets.pluck(:host_id).join(',')})" } end end |