summaryrefslogtreecommitdiff
path: root/app/uploaders/personal_file_uploader.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/uploaders/personal_file_uploader.rb')
-rw-r--r--app/uploaders/personal_file_uploader.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/app/uploaders/personal_file_uploader.rb b/app/uploaders/personal_file_uploader.rb
new file mode 100644
index 00000000000..969b0a20d38
--- /dev/null
+++ b/app/uploaders/personal_file_uploader.rb
@@ -0,0 +1,15 @@
+class PersonalFileUploader < FileUploader
+ def self.dynamic_path_segment(model)
+ File.join(CarrierWave.root, model_path(model))
+ end
+
+ private
+
+ def secure_url
+ File.join(self.class.model_path(model), secret, file.filename)
+ end
+
+ def self.model_path(model)
+ File.join("/#{base_dir}", model.class.to_s.underscore, model.id.to_s)
+ end
+end