From 9a9d21470ec24e50168b3b4c5e9c0549c527425a Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Mon, 16 Apr 2012 11:53:37 +0200 Subject: [PATCH] Only do cache cleanup if cache already exists. --- config/application.rb | 5 ++--- config/initializers/cache.rb | 4 +++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/config/application.rb b/config/application.rb index 5797669c4..6032f943a 100644 --- a/config/application.rb +++ b/config/application.rb @@ -61,9 +61,8 @@ module Zammad # Version of your assets, change this if you want to expire all your assets config.assets.version = '1.0' - - + # Use a different cache store in production - config.cache_store = :file_store, 'tmp/cache/file_store' + config.cache_store = :file_store, 'tmp/cache/file_store' end end diff --git a/config/initializers/cache.rb b/config/initializers/cache.rb index 6f5dd270b..9ffa80a34 100644 --- a/config/initializers/cache.rb +++ b/config/initializers/cache.rb @@ -1,5 +1,7 @@ # clear cache -Rails.cache.clear +if Zammad::Application.config.cache_store[1] && File.directory?(Zammad::Application.config.cache_store[1]) + Rails.cache.clear +end # to get rails caching working, load models Dir.foreach("#{Rails.root}/app/models") do |model_name|