debian-mirror-gitlab/app/models/ci/resource.rb

14 lines
439 B
Ruby
Raw Normal View History

2020-03-13 15:44:24 +05:30
# frozen_string_literal: true
module Ci
class Resource < ApplicationRecord
extend Gitlab::Ci::Model
belongs_to :resource_group, class_name: 'Ci::ResourceGroup', inverse_of: :resources
2021-03-11 19:13:27 +05:30
belongs_to :processable, class_name: 'Ci::Processable', foreign_key: 'build_id', inverse_of: :resource
2020-03-13 15:44:24 +05:30
2021-03-11 19:13:27 +05:30
scope :free, -> { where(processable: nil) }
scope :retained_by, -> (processable) { where(processable: processable) }
2020-03-13 15:44:24 +05:30
end
end