demarches-normaliennes/app/uploaders/commentaire_file_uploader.rb

24 lines
469 B
Ruby
Raw Normal View History

2017-10-30 16:07:02 +01:00
class CommentaireFileUploader < BaseUploader
def root
File.join(Rails.root, 'public')
end
if Features.remote_storage
storage :fog
else
storage :file
end
def store_dir
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end
2017-10-31 16:21:26 +01:00
def extension_white_list
%w(pdf doc docx xls xlsx ppt pptx odt ods odp jpg jpeg png zip txt)
end
def accept_extension_list
extension_white_list.map{ |e| ".#{e}" }.join(",")
end
2017-10-30 16:07:02 +01:00
end