Fix ensure_iid! method override problem
This commit is contained in:
parent
30a6fb64db
commit
6a108b8fbd
|
@ -26,10 +26,10 @@ module AtomicInternalId
|
||||||
|
|
||||||
module ClassMethods
|
module ClassMethods
|
||||||
def has_internal_id(column, scope:, init:, presence: true) # rubocop:disable Naming/PredicateName
|
def has_internal_id(column, scope:, init:, presence: true) # rubocop:disable Naming/PredicateName
|
||||||
before_validation :"ensure_#{column}!", on: :create
|
before_validation :"ensure_#{scope}_#{column}!", on: :create
|
||||||
validates column, presence: presence, numericality: true
|
validates column, presence: presence, numericality: true
|
||||||
|
|
||||||
define_method("ensure_#{column}!") do
|
define_method("ensure_#{scope}_#{column}!") do
|
||||||
scope_value = association(scope).reader
|
scope_value = association(scope).reader
|
||||||
|
|
||||||
if read_attribute(column).blank? && scope_value
|
if read_attribute(column).blank? && scope_value
|
||||||
|
|
|
@ -6,8 +6,8 @@ module Gitlab
|
||||||
include Chain::Helpers
|
include Chain::Helpers
|
||||||
|
|
||||||
def perform!
|
def perform!
|
||||||
# TODO: allocate next IID outside of transaction
|
# Allocate next IID outside of transaction
|
||||||
pipeline.ensure_iid!
|
pipeline.ensure_project_iid!
|
||||||
|
|
||||||
::Ci::Pipeline.transaction do
|
::Ci::Pipeline.transaction do
|
||||||
pipeline.save!
|
pipeline.save!
|
||||||
|
|
Loading…
Reference in New Issue