blob: f2ad0badd53d8f9e4acb305dbd81e71258e1624c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
class PersonalFileUploader < FileUploader
# Re-Override
def self.root
options.storage_path
end
def self.base_dir(model)
File.join(options.base_dir, model_path_segment(model))
end
def self.model_path_segment(model)
return 'temp/' unless model
File.join(model.class.to_s.underscore, model.id.to_s)
end
# model_path_segment does not require a model to be passed, so we can always
# generate a path, even when there's no model.
def model_valid?
true
end
# Revert-Override
def store_dir
File.join(base_dir, dynamic_segment)
end
private
def secure_url
File.join('/', base_dir, secret, file.filename)
end
end
|