Module: Ci::Partitionable

Overview

This module implements a way to set the partition_id value on a dependent resource from a parent record. Usage:

class PipelineVariable < Ci::ApplicationRecord
  include Ci::Partitionable

  belongs_to :pipeline
  partitionable scope: :pipeline
  # Or
  partitionable scope: ->(record) { record.partition_value }

Defined Under Namespace

Modules: Switch, Testing

Class Method Summary collapse

Class Method Details

.registered_modelsObject



40
41
42
43
44
# File 'app/models/concerns/ci/partitionable.rb', line 40

def self.registered_models
  Gitlab::Database::Partitioning
    .registered_models
    .select { |model| model < Ci::ApplicationRecord && model < Ci::Partitionable }
end