Class: Shoppe::AttachmentUploader

Inherits:
CarrierWave::Uploader::Base
  • Object
show all
Includes:
CarrierWave::MiniMagick
Defined in:
app/uploaders/shoppe/attachment_uploader.rb

Instance Method Summary collapse

Instance Method Details

#image?(new_file) ⇒ Boolean

Returns true if the file is an image

Returns:

  • (Boolean)


15
16
17
# File 'app/uploaders/shoppe/attachment_uploader.rb', line 15

def image?(new_file)
  self.file.content_type.include? 'image'
end

#not_image?(new_file) ⇒ Boolean

Returns true if the file is not an image

Returns:

  • (Boolean)


20
21
22
# File 'app/uploaders/shoppe/attachment_uploader.rb', line 20

def not_image?(new_file)
  !self.file.content_type.include? 'image'
end

#store_dirObject

Where should files be stored?



10
11
12
# File 'app/uploaders/shoppe/attachment_uploader.rb', line 10

def store_dir
  "attachment/#{model.id}"
end