summaryrefslogtreecommitdiff
path: root/app/uploaders/personal_file_uploader.rb
blob: 969b0a20d38bf070b31facd93638c6d003450b2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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