From 1cc57c620f28344452e8171a3f9f7b64d2036ad0 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Sat, 14 Jan 2012 13:26:01 +0000 Subject: [PATCH 1/1] Monkey patch ActionCachePath to fix a bug When infer_extension is not set ActionCachePath does not set the extension from any explicitly specified format, and hence expiry produces cache keys which don't have any extension and don't match the keys generated when the cache entry was created. --- config/initializers/action_cache_path.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 config/initializers/action_cache_path.rb diff --git a/config/initializers/action_cache_path.rb b/config/initializers/action_cache_path.rb new file mode 100644 index 000000000..b25aa14db --- /dev/null +++ b/config/initializers/action_cache_path.rb @@ -0,0 +1,19 @@ +module ActionController + module Caching + module Actions + class ActionCachePath + def initialize(controller, options = {}, infer_extension = true) + if infer_extension + @extension = controller.params[:format] + options.reverse_merge!(:format => @extension) if options.is_a?(Hash) + else + @extension = options[:format] + end + + path = controller.url_for(options).split(%r{://}).last + @path = normalize!(path) + end + end + end + end +end -- 2.43.2