Class: Tienda::ImageUploader
- Inherits:
-
CarrierWave::Uploader::Base
- Object
- CarrierWave::Uploader::Base
- Tienda::ImageUploader
- Includes:
- CarrierWave::MiniMagick
- Defined in:
- app/uploaders/tienda/image_uploader.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#download_url(filename) ⇒ Object
You can find full list of custom headers in AWS SDK documentation on AWS::S3::S3Object.
-
#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
#download_url(filename) ⇒ Object
You can find full list of custom headers in AWS SDK documentation on AWS::S3::S3Object
43 44 45 |
# File 'app/uploaders/tienda/image_uploader.rb', line 43 def download_url(filename) url(response_content_disposition: %Q{attachment; filename="#{filename}"}) end |
#extension_white_list ⇒ Object
Add a white list of extensions which are allowed to be uploaded. For images you might use something like this:
37 38 39 |
# File 'app/uploaders/tienda/image_uploader.rb', line 37 def extension_white_list %w(jpg jpeg gif png) 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:
11 12 13 |
# File 'app/uploaders/tienda/image_uploader.rb', line 11 def store_dir "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" end |