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.
This commit is contained in:
Tom Hughes 2012-01-14 13:26:01 +00:00
parent b83af6ef2c
commit 1cc57c620f

View file

@ -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