Sha256: 141d0c84fb7dc0d9ecfd1f0444daa32820d9efd7e4ff041c9021111644af5fba
Contents?: true
Size: 1.18 KB
Versions: 10
Compression:
Stored size: 1.18 KB
Contents
module Katello class Subscription < Katello::Model include Glue::Candlepin::CandlepinObject include Glue::Candlepin::Subscription include Katello::Authorization::Subscription has_many :products, :through => :subscription_products, :class_name => "Katello::Product" has_many :subscription_products, :class_name => "Katello::SubscriptionProduct", :dependent => :destroy, :inverse_of => :subscription has_many :pools, :class_name => "Katello::Pool", :inverse_of => :subscription, :dependent => :destroy belongs_to :organization, :class_name => "Organization", :inverse_of => :subscriptions scope :in_organization, ->(org) { where(:organization => org) } def self.with_subscribable_content joins(:products). where("#{Katello::Product.table_name}.id" => Product.with_subscribable_content) end def redhat? self.products.any? { |product| product.redhat? } end def active? pools.any?(&:active?) end def expiring_soon? pools.any?(&:expiring_soon?) end def recently_expired? pools.any?(&:recently_expired?) end def self.humanize_class_name(_name = nil) _("Subscription") end end end
Version data entries
10 entries across 10 versions & 1 rubygems