Class: CustomFields::Types::File::FileUploader
- Inherits:
-
CarrierWave::Uploader::Base
- Object
- CarrierWave::Uploader::Base
- CustomFields::Types::File::FileUploader
- Includes:
- CarrierWave::MimeTypes
- Defined in:
- lib/locomotive/custom_fields.rb
Instance Method Summary collapse
- #cache_dir ⇒ Object
-
#guess_url ⇒ String
In some situations, for instance, for the notification email when a content entry is created, we need to know the url of the file without breaking the upload process.
-
#store_dir ⇒ Object
Set correct paths.
Methods inherited from CarrierWave::Uploader::Base
#build_store_dir, #to_label, #to_liquid
Instance Method Details
#cache_dir ⇒ Object
56 57 58 |
# File 'lib/locomotive/custom_fields.rb', line 56 def cache_dir "#{Rails.root}/tmp/uploads" end |
#guess_url ⇒ String
In some situations, for instance, for the notification email when a content entry is created, we need to know the url of the file without breaking the upload process. Actually, the uploaded file will be written on the filesystem after the email is sent.
50 51 52 53 54 |
# File 'lib/locomotive/custom_fields.rb', line 50 def guess_url this = self.class.new(model, mounted_as) this.retrieve_from_store!(model.read_uploader(mounted_as)) this.url.to_s end |
#store_dir ⇒ Object
Set correct paths
40 41 42 |
# File 'lib/locomotive/custom_fields.rb', line 40 def store_dir "sites/#{model.site_id}/content_#{model.class.model_name.demodulize.underscore}/#{model.id}/files" end |