app/models/katello/pool.rb in katello-2.4.5 vs app/models/katello/pool.rb in katello-3.0.0.rc1
- old
+ new
@@ -1,13 +1,18 @@
module Katello
class Pool < Katello::Model
include Katello::Authorization::Pool
+
+ attr_accessor :quantity_attached
+
belongs_to :subscription, :inverse_of => :pools, :class_name => "Katello::Subscription"
has_many :activation_keys, :through => :pool_activation_keys, :class_name => "Katello::ActivationKey"
has_many :pool_activation_keys, :class_name => "Katello::PoolActivationKey", :dependent => :destroy, :inverse_of => :pool
+ scope :in_org, -> (org_id) { joins(:subscription).where("#{Katello::Subscription.table_name}.organization_id = ?", org_id) }
+
self.include_root_in_json = false
include Glue::Candlepin::Pool
include Glue::Candlepin::CandlepinObject
@@ -30,14 +35,9 @@
validates_lengths_from_database
DAYS_EXPIRING_SOON = 120
DAYS_RECENTLY_EXPIRED = 30
-
- # ActivationKey includes the Pool's json in its own'
- def as_json(*_args)
- self.remote_data.merge(:cp_id => self.cp_id)
- end
def self.active(subscriptions)
subscriptions.select { |s| s.active }
end