Fix carrierwave root issues
This commit is contained in:
parent
a62076c34b
commit
7fbee7a5b5
5 changed files with 8 additions and 4 deletions
|
@ -14,7 +14,7 @@ class Cerfa < ActiveRecord::Base
|
|||
if Features.remote_storage
|
||||
(RemoteDownloader.new content.filename).url
|
||||
else
|
||||
(LocalDownloader.new content, 'CERFA').url
|
||||
(LocalDownloader.new content.path, 'CERFA').url
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -22,7 +22,7 @@ class PieceJustificative < ActiveRecord::Base
|
|||
if Features.remote_storage
|
||||
(RemoteDownloader.new content.filename).url
|
||||
else
|
||||
(LocalDownloader.new content,
|
||||
(LocalDownloader.new content.path,
|
||||
(type_de_piece_justificative.nil? ? content.original_filename : type_de_piece_justificative.libelle)).url
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,7 +14,7 @@ class CerfaUploader < CarrierWave::Uploader::Base
|
|||
# This is a sensible default for uploaders that are meant to be mounted:
|
||||
def store_dir
|
||||
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
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ class PieceJustificativeUploader < CarrierWave::Uploader::Base
|
|||
# This is a sensible default for uploaders that are meant to be mounted:
|
||||
def store_dir
|
||||
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
|
||||
|
||||
|
|
|
@ -2,6 +2,10 @@
|
|||
|
||||
class ProcedureLogoUploader < CarrierWave::Uploader::Base
|
||||
|
||||
def root
|
||||
File.join(Rails.root, "public")
|
||||
end
|
||||
|
||||
# Choose what kind of storage to use for this uploader:
|
||||
if Features.remote_storage
|
||||
storage :fog
|
||||
|
|
Loading…
Reference in a new issue