CacheSweepers and url_for
December 31st, 2007 Posted in ActionController, ActionView, Rails, RubyIt appears url_for only seems to work correctly in a CacheSweeper when running a server in production mode. I’ve confirmed this in Rails 2.0.2.
class MySeeper < ActionController::Caching::Sweeper observe Item def after_create(item) value = url_for(:controller => :items) end end
In development mode, value evaluates to nil. Peculiar indeed …