Class: ThingUploader
- Inherits:
-
CarrierWave::Uploader::Base
- Object
- CarrierWave::Uploader::Base
- ThingUploader
- Includes:
- CarrierWave::RMagick
- Defined in:
- app/uploaders/thing_uploader.rb
Instance Method Summary collapse
-
#cache_dir ⇒ Object
got this from stackoverflow.com/questions/9561641/carrierwave-temp-directory-set-to-uploads-tmp-folder without this all tmp files would go to /public/uploads/tmp which is not cool at all.
-
#extension_white_list ⇒ Object
Add a white list of extensions which are allowed to be uploaded.
-
#store_dir ⇒ Object
Override the directory where uploaded files will be stored.
Instance Method Details
#cache_dir ⇒ Object
got this from stackoverflow.com/questions/9561641/carrierwave-temp-directory-set-to-uploads-tmp-folder without this all tmp files would go to /public/uploads/tmp which is not cool at all.
63 64 65 66 |
# File 'app/uploaders/thing_uploader.rb', line 63 def cache_dir # should return path to cache dir Rails.root.join 'tmp/uploads' end |
#extension_white_list ⇒ Object
Add a white list of extensions which are allowed to be uploaded.
51 52 53 |
# File 'app/uploaders/thing_uploader.rb', line 51 def extension_white_list %w(mp3 pdf) end |
#store_dir ⇒ Object
Override the directory where uploaded files will be stored. This is a sensible default for uploaders that are meant to be mounted:
17 18 19 20 |
# File 'app/uploaders/thing_uploader.rb', line 17 def store_dir # "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" --- that was the suggested one "system/things/#{model.class.to_s.underscore}/#{model.id}" end |