This website requires JavaScript.
Explore
Help
Sign in
kotovalexarian-likes-gitlab
/
gitlab-org--gitlab-foss
Watch
1
Star
0
Fork
You've already forked gitlab-org--gitlab-foss
0
Code
Releases
Activity
564d78dac1
gitlab-org--gitlab-foss
/
app
/
models
/
personal_snippet.rb
6 lines
89 B
Ruby
Raw
Normal View
History
Unescape
Escape
Enable frozen string in app/models/*.rb Partially addresses #47424.
2018-07-25 05:30:33 -04:00
# frozen_string_literal: true
Personal snippet model added
2013-03-24 18:18:03 -04:00
class
PersonalSnippet
<
Snippet
Fix an N+1 in avatar URLs This is tricky: the query was being run in `ObjectStorage::Extension::RecordsUploads#retrieve_from_store!`, but we can't just add batch loading there, because the `#upload=` method there would use the result immediately, making the batch only have one item. Instead, we can pre-emptively add an item to the batch whenever an avatarable object is initialized, and then reuse that batch item in `#retrieve_from_store!`. However, this also has problems: 1. There is a lot of logic in `Avatarable#retrieve_upload_from_batch`. 2. Some of that logic constructs a 'fake' model for the batch key. This should be fine, because of ActiveRecord's override of `#==`, but it relies on that staying the same.
2018-04-19 12:22:23 -04:00
include
WithUploads
Personal snippet model added
2013-03-24 18:18:03 -04:00
end
Copy permalink