Added Paperclip attachment handler

This commit is contained in:
Christoph Haas 2015-01-04 14:19:19 +01:00
parent 9ce7de03b1
commit 7aca36e46b
4 changed files with 30 additions and 6 deletions

View file

@ -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