Hello everyone. I''m having some trouble with calling render_to_string from a separate controller. I''m also new with using methods from other controllers, but I think I''ve got a grasp on that. So here''s what I''m doing: - In controller A: blah = ControllerB.new blah.doStuff() - In controller B def doStuff ... mystring = render_to_string :partial => ''blahblah'' end And this is the error I''m receiving: " NoMethodError in ThingsController#create You have a nil object when you didn''t expect it! The error occurred while evaluating nil.body c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/base.rb:908:in `erase_render_results'' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.13.3/lib/action_controller/base.rb:788:in `render_to_string'' #{RAILS_ROOT}/app/controllers/facebook_controller.rb:43:in `update_profile'' #{RAILS_ROOT}/app/controllers/things_controller.rb:43:in `create'' " The problem is with the render_to_string being called. I did some research into erase_render_results, which is called by render_to_string to apparently clear the output, and prevent DoubleRender errors. You can see the source (I think) here: http://dev.rubyonrails.org/changeset/1918 So, I believe it''s breaking on the line "@response.body = nil" Does anybody have any advice about how to use render_to_string in a controller, being called from a different controller? It''s driving me crazy, and is starting to seem like a Ruby bug. The code runs fine if called directly from controller B, but several different controllers will need to call this method, and I''d like to keep it out of application.rb if possible. -- 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 -~----------~----~----~----~------~----~------~--~---