diff options
author | Jarka Kadlecova <jarka@gitlab.com> | 2017-05-01 16:14:35 +0300 |
---|---|---|
committer | Jarka Kadlecova <jarka@gitlab.com> | 2017-05-02 16:22:24 +0300 |
commit | 43ff7386411af0f538710f3627622f71e5e34472 (patch) | |
tree | 3bb4d32c1389504d70395f36e8e223899fcbccd5 /app/uploaders/personal_file_uploader.rb | |
parent | 6277bda61c511696f9d12fae4238b5214a722571 (diff) |
Support uploaders for personal snippets comments
Diffstat (limited to 'app/uploaders/personal_file_uploader.rb')
-rw-r--r-- | app/uploaders/personal_file_uploader.rb | 15 |
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 |