BigW Consortium Gitlab

Commit 6a108b8f by Shinya Maeda

Fix ensure_iid! method override problem

parent 30a6fb64
...@@ -26,10 +26,10 @@ module AtomicInternalId ...@@ -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 ...@@ -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!
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment