debian-mirror-gitlab/app/uploaders/personal_file_uploader.rb

24 lines
492 B
Ruby
Raw Normal View History

2017-08-17 22:00:37 +05:30
class PersonalFileUploader < FileUploader
def self.dynamic_path_segment(model)
File.join(CarrierWave.root, model_path(model))
end
2017-09-10 17:25:29 +05:30
def self.base_dir
File.join(root_dir, '-', 'system')
end
2017-08-17 22:00:37 +05:30
private
def secure_url
File.join(self.class.model_path(model), secret, file.filename)
end
def self.model_path(model)
2017-09-10 17:25:29 +05:30
if model
File.join("/#{base_dir}", model.class.to_s.underscore, model.id.to_s)
else
File.join("/#{base_dir}", 'temp')
end
2017-08-17 22:00:37 +05:30
end
end