demarches-normaliennes/app/uploaders/commentaire_file_uploader.rb
2019-07-31 15:15:09 +02:00

23 lines
520 B
Ruby

class CommentaireFileUploader < BaseUploader
def root
Rails.root.join("public")
end
if Rails.application.secrets.fog[:enabled]
storage :fog
else
storage :file
end
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
def extension_whitelist
['pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'odt', 'ods', 'odp', 'jpg', 'jpeg', 'png', 'zip', 'txt']
end
def accept_extension_list
extension_whitelist.map { |e| ".#{e}" }.join(",")
end
end