Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
bc3fc8ec
Commit
bc3fc8ec
authored
Mar 14, 2018
by
Andreas Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only support single scope argument.
We can extend this later, but for now we don't have the use case.
parent
4c1e6fd0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
4 deletions
+2
-4
app/models/concerns/atomic_internal_id.rb
app/models/concerns/atomic_internal_id.rb
+2
-4
No files found.
app/models/concerns/atomic_internal_id.rb
View file @
bc3fc8ec
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment