Unsuccessful attempt to properly eager load screenshots.
Currently the virtual attribute "image_url" in the screenshots model apparently runs one SQL query each to get the packages data.
This commit is contained in:
parent
88dfb33721
commit
76d19f7e78
3 changed files with 14 additions and 8 deletions
|
|
@ -4,7 +4,9 @@ class Screenshot < ActiveRecord::Base
|
|||
# Return the URL to this screenshot.
|
||||
# size: 'small' (thumbnail) or 'large' (full-size)
|
||||
# (If possible serve the screenshots statically from the web server.)
|
||||
#attr_accessor :image_url
|
||||
def image_url(size)
|
||||
# TODO: Prevents proper eager loading somehow...
|
||||
"/screenshots/#{self.package.name[0]}/#{self.package.name}/#{self.id}_#{size}.png"
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue