Cache sweeping and render_component (my mistake or Rails bug

Hi

I’m working on a program which relies on heavy cache sweeper usage.
I’ve just bumped onto an odd problem. When using render_component
method in layouts or templates with cache sweeping turned on, Rails
throws an exception with the following message:

NoMethodError in TestController#index

You have a nil object when you didn’t expect it!
The error occured while evaluating nil.controller_name

where TestController is obviously my controller class name. I’m running
Rails 1.1.6 on linux box. My test app which extracts the error consists
of a controller which body is only:

require ‘sweeper’
class TestController < ApplicationController
cache_sweeper :sweeper

def index
end

def foo
render :text => “foo”
end
end

The file sweeper.rb contains my sweeper class definition:
class Sweeper < ActionController::Caching::Sweeper
observe Bar
end
Bar is an empty model, with a table bars containing only id field.
I’ve turned the caching on by setting
config.action_controller.perform_caching = true in
config/development/environment.rb file.

Exception is thrown in
actionpack-1.12.5/lib/action_controller/caching.rb file in line 541.
Am I doing something wrong or it’s some kind of a Rails bug?

Andrzej, have you found the solution to this? I’m facing similar issue.
Thanks.

Andrzej, have you found the solution to this? I’m facing similar issue.

Yes, I got rid of render_component. Unfortunately that’s probably not
the kind of answer you’d like to see. Component caching was broken in
Rails 1.1.6 and I haven’t checked it’s behavior in later versions.
Should you come up with a means of fixing the problem in question,
please let me know;)

regards
Andrzej Zawadzki