Sha256: 8899074ea61ce07e6da29ec9b0b76fd8ef6e9afd03aa2986b31ed5d5434ad67a
Contents?: true
Size: 917 Bytes
Versions: 2
Compression:
Stored size: 917 Bytes
Contents
class Spree::Upload < ::Spree::Asset default_scope where(:type => "Upload") if table_exists? validate :no_attachement_errors has_attached_file :attachment, :styles => Proc.new{ |clip| clip.instance.attachment_sizes }, :default_style => :medium def image_content? attachment_content_type.match(/\/(jpeg|png|gif|tiff|x-photoshop)/) end def attachment_sizes if image_content? { :mini => '48x48>', :small => '150x150>', :medium => '420x300>', :large => '800x500>' } else {} end end def no_attachement_errors if attachment_file_name.blank? || !attachment.errors.empty? # uncomment this to get rid of the less-than-useful interrim messages errors.clear errors.add :attachment, "Paperclip returned errors for file '#{attachment_file_name}' - check ImageMagick installation or image source file." false end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
spree_essentials-0.4.0.rc2 | app/models/spree/upload.rb |
spree_essentials-0.4.0.rc1 | app/models/spree/upload.rb |