From 0b45e90e587087dbfefe59841c37ac8b4d4f2e93 Mon Sep 17 00:00:00 2001 From: Guillaume Lazzara Date: Tue, 7 Jun 2016 10:32:21 +0200 Subject: [PATCH] Set specific cache path regarding environment --- app/uploaders/cerfa_uploader.rb | 6 +++++- app/uploaders/piece_justificative_uploader.rb | 6 +++++- app/uploaders/procedure_logo_uploader.rb | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app/uploaders/cerfa_uploader.rb b/app/uploaders/cerfa_uploader.rb index c69dcbac8..b09da7e77 100644 --- a/app/uploaders/cerfa_uploader.rb +++ b/app/uploaders/cerfa_uploader.rb @@ -19,7 +19,11 @@ class CerfaUploader < CarrierWave::Uploader::Base end def cache_dir - '/tmp/tps-cache' + if Rails.env.production? + '/tmp/tps-cache' + else + '/tmp/tps-dev-cache' + end end # Add a white list of extensions which are allowed to be uploaded. diff --git a/app/uploaders/piece_justificative_uploader.rb b/app/uploaders/piece_justificative_uploader.rb index ce446eb0a..22f07bc40 100644 --- a/app/uploaders/piece_justificative_uploader.rb +++ b/app/uploaders/piece_justificative_uploader.rb @@ -19,7 +19,11 @@ class PieceJustificativeUploader < CarrierWave::Uploader::Base end def cache_dir - '/tmp/tps-cache' + if Rails.env.production? + '/tmp/tps-cache' + else + '/tmp/tps-dev-cache' + end end # Add a white list of extensions which are allowed to be uploaded. diff --git a/app/uploaders/procedure_logo_uploader.rb b/app/uploaders/procedure_logo_uploader.rb index 1199b32fa..b57540698 100644 --- a/app/uploaders/procedure_logo_uploader.rb +++ b/app/uploaders/procedure_logo_uploader.rb @@ -22,7 +22,11 @@ class ProcedureLogoUploader < CarrierWave::Uploader::Base end def cache_dir - '/tmp/tps-cache' + if Rails.env.production? + '/tmp/tps-cache' + else + '/tmp/tps-dev-cache' + end end # Add a white list of extensions which are allowed to be uploaded.