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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
45b1b6a1
Commit
45b1b6a1
authored
Sep 21, 2020
by
Arturo Herrero
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unnecessary retrieving of IDs
parent
45fcb256
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
6 deletions
+1
-6
app/services/bulk_update_integration_service.rb
app/services/bulk_update_integration_service.rb
+1
-6
No files found.
app/services/bulk_update_integration_service.rb
View file @
45b1b6a1
...
...
@@ -8,16 +8,11 @@ class BulkUpdateIntegrationService
# rubocop: disable CodeReuse/ActiveRecord
def
execute
# Retrieving the IDs instantiates the ActiveRecord relation (batch)
# into concrete models, otherwise update_all will clear the relation.
# https://stackoverflow.com/q/34811646/462015
batch_ids
=
batch
.
pluck
(
:id
)
Service
.
transaction
do
batch
.
update_all
(
service_hash
)
if
integration
.
data_fields_present?
integration
.
data_fields
.
class
.
where
(
service_id:
batch
_ids
).
update_all
(
data_fields_hash
)
integration
.
data_fields
.
class
.
where
(
service_id:
batch
.
select
(
:id
)
).
update_all
(
data_fields_hash
)
end
end
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