diff options
author | Andreas Brandl <abrandl@gitlab.com> | 2018-03-14 14:36:07 +0100 |
---|---|---|
committer | Andreas Brandl <abrandl@gitlab.com> | 2018-03-16 13:35:27 +0100 |
commit | bc3fc8ec3eec74876a0e2125248c27cde153e32b (patch) | |
tree | 7ed6455977bc0dba662d650c9d62b41ae44d2e71 | |
parent | 4c1e6fd0e83ceb550ec07448d6a37e76cc25e4fa (diff) | |
download | gitlab-ce-bc3fc8ec3eec74876a0e2125248c27cde153e32b.tar.gz |
Only support single scope argument.
We can extend this later, but for now we don't have the use case.
-rw-r--r-- | app/models/concerns/atomic_internal_id.rb | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/app/models/concerns/atomic_internal_id.rb b/app/models/concerns/atomic_internal_id.rb index 6f2d60a7ee9..343edc237c9 100644 --- a/app/models/concerns/atomic_internal_id.rb +++ b/app/models/concerns/atomic_internal_id.rb @@ -28,11 +28,9 @@ module AtomicInternalId def has_internal_id(on, scope:, usage: nil, init:) # rubocop:disable Naming/PredicateName before_validation(on: :create) do if self.public_send(on).blank? # rubocop:disable GitlabSecurity/PublicSend - scope_attrs = [scope].flatten.compact.each_with_object({}) do |e, h| - h[e] = self.public_send(e) # rubocop:disable GitlabSecurity/PublicSend - end - + scope_attrs = { scope => self.public_send(scope) } # rubocop:disable GitlabSecurity/PublicSend usage = (usage || self.class.table_name).to_sym + new_iid = InternalId.generate_next(self, scope_attrs, usage, init) self.public_send("#{on}=", new_iid) # rubocop:disable GitlabSecurity/PublicSend end |