Added Paperclip attachment handler
This commit is contained in:
parent
9ce7de03b1
commit
7aca36e46b
4 changed files with 30 additions and 6 deletions
|
|
@ -5,6 +5,12 @@ class Screenshot < ActiveRecord::Base
|
|||
order('uploaddatetime DESC')
|
||||
}
|
||||
|
||||
has_attached_file :image,
|
||||
styles: { :large => "800x600>", :thumb => "160x120>" },
|
||||
default_url: "/images/dummy/no-screenshots-upload-one.svg"
|
||||
#path: :rails_root/public/system/:class/:attachment/:id_partition/:style/:filename
|
||||
validates_attachment_content_type :image, :content_type => /\Aimage\/png\Z/
|
||||
|
||||
def image_url(size)
|
||||
"#{Rails.configuration.images_path_prefix}/#{self.package.name[0]}/#{self.package.name}/#{self.id}_#{size}.png"
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue