Files
dunlop-core/app/models/dunlop/target_file_uploader.rb
T
2018-01-20 13:02:44 -03:00

22 lines
474 B
Ruby

# encoding: utf-8
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