Writing To The Response in Rails? (Like “echo” in PHP)

前端 未结 4 1697
小鲜肉
小鲜肉 2021-02-07 08:37

I know that I can do this in Rails:

<%=\"hello\" %>

but is there any way to do this

<%
echo \"hello\"
%>

4条回答
  •  暗喜
    暗喜 (楼主)
    2021-02-07 09:09

    What you have to write is

    <% concat "bank" %>
    

    now you can do something like

    <%
      10.times do
        concat "cat"
      end
    %>
    

    for ten cat

提交回复
热议问题