summaryrefslogtreecommitdiff
path: root/app/models/ci/resource.rb
blob: ee5b6546165bb47c4adde08a31468a0b771ed305 (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 :build, class_name: 'Ci::Build', inverse_of: :resource

    scope :free, -> { where(build: nil) }
    scope :retained_by, -> (build) { where(build: build) }
  end
end