views:

26

answers:

1

I am using Rails 2.3.5, but when I use (in HAML)

- s = render_to_string :text => "hello"

or render a partial, it says render_to_string is not a defined method? Clearly it is in the API:

http://api.rubyonrails.org/classes/ActionController/Base.html#M000465

Right now I am using this instead:

- s = render :text => "hello"

since it is - in front, the output is not sent to the webpage output, but render also returns a string for s.

+1  A: 

You are reading the documentation for ActionController. The render you are actually calling is in ActionView::TemplateHandler.

http://api.rubyonrails.org/classes/ActionView/TemplateHandler.html#M002322

jdl
so it is almost no documentation at all? In the existing code, I can call render in the View almost the same as in Controller.
動靜能量
Correct, the docs are pretty bad, and the two versions of render are similar but not identical.
jdl