mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
created optimized_image model
This commit is contained in:
7
app/models/optimized_image.rb
Normal file
7
app/models/optimized_image.rb
Normal 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
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user