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
c81a37c1
Commit
c81a37c1
authored
May 04, 2018
by
Jan Provaznik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use find_in_batches instead of destroy_all
destroy_all loads all records at once
parent
7da3b2cd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
app/models/concerns/with_uploads.rb
app/models/concerns/with_uploads.rb
+3
-1
No files found.
app/models/concerns/with_uploads.rb
View file @
c81a37c1
...
...
@@ -32,6 +32,8 @@ module WithUploads
# it can not be done in after_commit because FileUploader requires loads
# associated model on destroy (which is already deleted in after_commit)
def
destroy_file_uploads
self
.
uploads
.
where
(
uploader:
FILE_UPLOADERS
).
destroy_all
self
.
uploads
.
where
(
uploader:
FILE_UPLOADERS
).
find_each
do
|
upload
|
upload
.
destroy
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