Where did url_for go in my cache Sweeper

hmmmmm,

Where oh, where did the url_for method go? I have a Sweeper that uses
url_for to generate new page caches whenever the model changes (kind of
active caching).
In this case I am using a custom method rather than Caching.cache_page,
since I want the page to cache all the time (ignoring the normal caching
rules).
The sweeper is being woken up just fine, but there is some strange
behaviour happening with the url_for method…

class PublishSweeper < ActionController::Caching::Sweeper
observe Computer, Node, Program

def after_save(record)
puts self.inspect
case record
when Node
write_cache(:controller=>“xml_server”, :action=>“node”,
:id=>record.id)
when Program
write_cache(:controller=>“xml_server”, :action=>“program”,
:id=>record.id)
end
end
end

private
def write_cache(path)
url_for(path)
end
end

In the first case (Node) url_for is available and returns what is
expected. However, in the second case (Program) url_for is nil (it’s not
being called at all). The sweeper call backs are being initiated from
the different actions in the same controller, and apart from saving
different model types there’s no other differences. Is there any obvious
reason that the method would disappear like this?? I’m stumped, any
ideas on what to look at (or better still a solution) would be
appreciated!

thanks,
Dan

By the way the “puts self.inspect” in after_save shows the folling:
when it is not working:
#PublishSweeper:0x377c13c

when it is working:
#<PublishSweeper:0x373ca8c
@controller=#<ProgramsController:0x373a070…

Something fishy seems to be going on with the sweepers access to
ActionController…