Andrzej
2006-Sep-12 22:44 UTC
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?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---
Herryanto Siatono
2007-Mar-27 04:20 UTC
Re: Cache sweeping and render_component (my mistake or Rails
Andrzej, have you found the solution to this? I''m facing similar issue. Thanks. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Andrzej Zawadzki
2007-Apr-07 18:59 UTC
Re: Cache sweeping and render_component (my mistake or Rails
> 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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Seemingly Similar Threads
- Problems when using sweepers with postbacks
- A bug in sweeper.rb? [was: A frustrating and strange error when config.action_controller.perform_caching = true]
- cache_sweeper causes undefined method error
- "value must be enumerable" exception when using a sweeper?
- cache_sweeper