Fix carrierwave root issues

This commit is contained in:
Guillaume Lazzara 2016-05-24 18:35:25 +02:00
parent a62076c34b
commit 7fbee7a5b5
5 changed files with 8 additions and 4 deletions

View file

@ -14,7 +14,7 @@ class Cerfa < ActiveRecord::Base
if Features.remote_storage if Features.remote_storage
(RemoteDownloader.new content.filename).url (RemoteDownloader.new content.filename).url
else else
(LocalDownloader.new content, 'CERFA').url (LocalDownloader.new content.path, 'CERFA').url
end end
end end
end end

View file

@ -22,7 +22,7 @@ class PieceJustificative < ActiveRecord::Base
if Features.remote_storage if Features.remote_storage
(RemoteDownloader.new content.filename).url (RemoteDownloader.new content.filename).url
else else
(LocalDownloader.new content, (LocalDownloader.new content.path,
(type_de_piece_justificative.nil? ? content.original_filename : type_de_piece_justificative.libelle)).url (type_de_piece_justificative.nil? ? content.original_filename : type_de_piece_justificative.libelle)).url
end end
end end

View file

@ -14,7 +14,7 @@ class CerfaUploader < CarrierWave::Uploader::Base
# This is a sensible default for uploaders that are meant to be mounted: # This is a sensible default for uploaders that are meant to be mounted:
def store_dir def store_dir
unless Features.remote_storage unless Features.remote_storage
"../uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" "./uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end end
end end

View file

@ -14,7 +14,7 @@ class PieceJustificativeUploader < CarrierWave::Uploader::Base
# This is a sensible default for uploaders that are meant to be mounted: # This is a sensible default for uploaders that are meant to be mounted:
def store_dir def store_dir
unless Features.remote_storage unless Features.remote_storage
"../uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" "./uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end end
end end

View file

@ -2,6 +2,10 @@
class ProcedureLogoUploader < CarrierWave::Uploader::Base class ProcedureLogoUploader < CarrierWave::Uploader::Base
def root
File.join(Rails.root, "public")
end
# Choose what kind of storage to use for this uploader: # Choose what kind of storage to use for this uploader:
if Features.remote_storage if Features.remote_storage
storage :fog storage :fog