concat

concat(string)
Instance Public methods

The preferred method of outputting text in your views is to use the <%= âtextâ %> eRuby syntax. The regular puts and print methods do not operate as expected in an eRuby code block. If you absolutely must output text within a non-output code block (i.e., <% %>), you can use the concat method.

<%
    concat "hello"
    # is the equivalent of <%= "hello" %>

    if logged_in
      concat "Logged in!"
    else
      concat link_to('login', action: :login)
    end
    # will either display "Logged in!" or a login link
%>
doc_ruby_on_rails
2015-06-20 00:00:00
Comments
Leave a Comment

Please login to continue.