When Testing Caching ...
October 15th, 2007
Don’t forget to set:
config.action_controller.perform_caching = true
in test.rb in environments. You’ll wonder why nothing is working until you do.
1 Response to “When Testing Caching ...”
Sorry, comments are closed for this article.
October 26th, 2007 at 02:32 PM Hi Matt, I came upon your blog from your comment on my posting on the timeout caching. I wanted to comment on that entry or at least email you some thoughts about your method. In your post, you have overload the method for cache to handle your force variable. In your logic for the controller you also set the force (@expire) value. What I am trying to understand is why you have not just added a single line to your controller that would solve having to had created a plugin to override cache method for views. For example:
class FrontpageController < ApplicationController def index expire_fragment("frontpage") if params[:special_param_to_hose_cache] == "1" if !read_fragment("frontpage") ... heavy lifiting goes here end end endThen your view would still call the original method in Rails for caching. If I am missing something please explain as I love the whole caching side of web apps -- obviously.