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)

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

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)

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

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

#store_dirObject

Where should files be stored?


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

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