Added image_url method for Screenshot model
This commit is contained in:
parent
5559fbecd3
commit
b62c799ee8
1 changed files with 10 additions and 0 deletions
10
app/models/screenshot.rb
Normal file
10
app/models/screenshot.rb
Normal 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
|
||||||
Loading…
Add table
Add a link
Reference in a new issue