summaryrefslogtreecommitdiff
path: root/app/models/ci/resource.rb
blob: e0e1fab642d2f97d5efff799edf12b8d94dc6762 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
# 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