debian-mirror-gitlab/app/models/ci/resource.rb
2021-03-11 19:13:27 +05:30

13 lines
439 B
Ruby

# frozen_string_literal: true
module Ci
class Resource < ApplicationRecord
extend Gitlab::Ci::Model
belongs_to :resource_group, class_name: 'Ci::ResourceGroup', inverse_of: :resources
belongs_to :processable, class_name: 'Ci::Processable', foreign_key: 'build_id', inverse_of: :resource
scope :free, -> { where(processable: nil) }
scope :retained_by, -> (processable) { where(processable: processable) }
end
end