Class: Lease::DocumentUploader
- Inherits:
-
CarrierWave::Uploader::Base
- Object
- CarrierWave::Uploader::Base
- Lease::DocumentUploader
- Defined in:
- app/uploaders/lease/document_uploader.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#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.
Class Method Details
.mime_type_white_list ⇒ Object
27 28 29 30 |
# File 'app/uploaders/lease/document_uploader.rb', line 27 def self.mime_type_white_list types = ['text/html', 'application/pdf'] types.join(', ') end |
Instance Method Details
#extension_white_list ⇒ Object
Add a white list of extensions which are allowed to be uploaded. For images you might use something like this:
23 24 25 |
# File 'app/uploaders/lease/document_uploader.rb', line 23 def extension_white_list %w[html htm 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 |
# File 'app/uploaders/lease/document_uploader.rb', line 17 def store_dir "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" end |