Files
dunlop-core/app/models/dunlop/source_file_uploader.rb
T
2019-10-11 07:32:33 -05:00

28 lines
712 B
Ruby

# encoding: utf-8
if defined?(CarrierWave)
class Dunlop::SourceFileUploader < CarrierWave::Uploader::Base
#storage :file
# Override the directory where uploaded files will be stored.
# This is a sensible default for uploaders that are meant to be mounted:
def store_dir
File.join(
Rails.application.config.file_storage_path,
model.class.to_s.underscore,
mounted_as.to_s,
model.id.to_s
)
end
def original_filename
File.basename(path.to_s)
end
end
else
# provide empty one. Still under investigation, but there seems to be a strict provision requirement in ruby 2.7 and or rails 6
class Dunlop::SourceFileUploader
end
end