diff options
author | Shinya Maeda <shinya@gitlab.com> | 2018-05-10 16:22:43 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2018-05-10 16:22:43 +0900 |
commit | 6a108b8fbd5f1b5c2d8e6b51bb34cda06fe0e5ee (patch) | |
tree | a9acccd078b316bb45cab3b54ef43b449cdd29d6 | |
parent | 30a6fb64dbce39cc0298e805935bb242c2d7b715 (diff) | |
download | gitlab-ce-6a108b8fbd5f1b5c2d8e6b51bb34cda06fe0e5ee.tar.gz |
Fix ensure_iid! method override problem
-rw-r--r-- | app/models/concerns/atomic_internal_id.rb | 4 | ||||
-rw-r--r-- | lib/gitlab/ci/pipeline/chain/create.rb | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/app/models/concerns/atomic_internal_id.rb b/app/models/concerns/atomic_internal_id.rb index 3d867df544f..876dd0ee1f2 100644 --- a/app/models/concerns/atomic_internal_id.rb +++ b/app/models/concerns/atomic_internal_id.rb @@ -26,10 +26,10 @@ module AtomicInternalId module ClassMethods 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 - define_method("ensure_#{column}!") do + define_method("ensure_#{scope}_#{column}!") do scope_value = association(scope).reader if read_attribute(column).blank? && scope_value diff --git a/lib/gitlab/ci/pipeline/chain/create.rb b/lib/gitlab/ci/pipeline/chain/create.rb index 5967a7a6a58..918a0d151fc 100644 --- a/lib/gitlab/ci/pipeline/chain/create.rb +++ b/lib/gitlab/ci/pipeline/chain/create.rb @@ -6,8 +6,8 @@ module Gitlab include Chain::Helpers def perform! - # TODO: allocate next IID outside of transaction - pipeline.ensure_iid! + # Allocate next IID outside of transaction + pipeline.ensure_project_iid! ::Ci::Pipeline.transaction do pipeline.save! |