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?
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?
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.
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.