Topic: Call to expire_fragment raises include url_for error

I've been upgrading a Rails 2 app to Rails 3.2.13 and am having a problems when I try to enable caching. Caching worked in Rails 2 and I'm using the same version of Ruby - 1.8.7. I'm not sure if it is relevant but I'm developing on OSX.

The error's being thrown from the ActionController::Caching::Fragments class when expire_fragment is called. expire_fragment makes a call to fragment_cache_key which contains this:

ActiveSupport::Cache.expand_cache_key(key.is_a?(Hash) ? url_for(key).split("://").last : key, :views)
This call to url_for is raising this error

RuntimeError (In order to use #url_for, you must include routing helpers explicitly.
For instance, `include Rails.application.routes.url_helpers):
ActionController::Base already has the UrlFor module included in it, and including it again as advised in the error message does not help anything.

I was hoping for some insight into why a gem that includes UrlFor would raise an error asking for url_helpers when it can already use url_for.

Last edited by njallbread (2013-07-10 05:44:01)