Added image_url method for Screenshot model

This commit is contained in:
Christoph Haas 2013-08-06 22:35:42 +02:00
parent 5559fbecd3
commit b62c799ee8

10
app/models/screenshot.rb Normal file
View file

@ -0,0 +1,10 @@
class Screenshot < ActiveRecord::Base
belongs_to :package
# Return the URL to this screenshot.
# size: 'small' (thumbnail) or 'large' (full-size)
# (If possible serve the screenshots statically from the web server.)
def image_url(size)
"/screenshots/#{self.package.name[0]}/#{self.package.name}/#{self.id}_#{size}.png"
end
end