diff options
author | Shinya Maeda <shinya@gitlab.com> | 2018-05-10 10:22:43 +0300 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2018-05-10 10:22:43 +0300 |
commit | 6a108b8fbd5f1b5c2d8e6b51bb34cda06fe0e5ee (patch) | |
tree | a9acccd078b316bb45cab3b54ef43b449cdd29d6 /app/models/concerns/atomic_internal_id.rb | |
parent | 30a6fb64dbce39cc0298e805935bb242c2d7b715 (diff) |
Fix ensure_iid! method override problem
Diffstat (limited to 'app/models/concerns/atomic_internal_id.rb')
-rw-r--r-- | app/models/concerns/atomic_internal_id.rb | 4 |
1 files changed, 2 insertions, 2 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 |