Writing To The Response in Rails? (Like "echo" in PHP)
Posted
by
Yar
on Stack Overflow
See other posts from Stack Overflow
or by Yar
Published on 2009-02-02T20:50:27Z
Indexed on
2010/12/29
11:54 UTC
Read the original article
Hit count: 123
I know that I can do this in Rails:
<%="hello" %>
but is there any way to do this
<%
echo "hello"
%>
and get it to show up in the response? I have tried response.write
which almost worked, but did not...
Edit: print or puts do not do it, because I do not want to write to the console. I want to write to the browser/HTTP client.
Edit: Here is an example:
<%
unless @research_activities.size == 0
concat(render(:partial => 'list'))
end
%>
Why would I want to include two closing tags just to do that? It reads nicely in code, doesn't it?
© Stack Overflow or respective owner