Files
dunlop-core/app/models/dunlop/target_file_uploader.rb
T

23 lines
534 B
Ruby

# encoding: utf-8
if defined?(CarrierWave)
class Dunlop::TargetFileUploader < 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
end