created optimized_image model

This commit is contained in:
Régis Hanol
2013-06-16 10:39:48 +02:00
parent 2c3f757951
commit 5de03814fb
5 changed files with 35 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
class OptimizedImage < ActiveRecord::Base
belongs_to :upload
def filename
"#{sha[0..2]}/#{sha[3..5]}/#{sha[6..16]}_#{width}x#{height}#{ext}"
end
end

View File

@@ -9,6 +9,8 @@ class Upload < ActiveRecord::Base
has_many :post_uploads
has_many :posts, through: :post_uploads
has_many :optimized_images
validates_presence_of :filesize
validates_presence_of :original_filename