views:

89

answers:

2

it seems that on Rails or erb, the only way to output anything is by <%= %>

<% puts "hello" %> won't work, unlike PHP.

is there any other method at all?

+1  A: 

The conventional response object does exist under the covers, and you can call response.write(str). But a large part of the beauty of RoR is that this nuts and bolts stuff is abstracted away for you, and you don't have to do it.

James L
thanks. from your answer i found a note about concat
動靜能量
why do you need to do this? not criticising, just interested.
James L
+2  A: 

concat will do:

<% concat ("wah ha ha!") %>

Reference:
http://api.rubyonrails.org/classes/ActionView/Helpers/TextHelper.html#M001710

from the source code,

<% output_buffer << "hmm" %>

will work too and it is tested... but i think this is even lower level and should be avoided.

動靜能量