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
0c3d7830c5
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 09:30:33 +00:00
# frozen_string_literal: true
Personal snippet model added
2013-03-24 22:18:03 +00: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 16:22:23 +00:00
include
WithUploads
Personal snippet model added
2013-03-24 22:18:03 +00:00
end