Friday 7 October 2016

Difference between <%, <%=, <%# and -%> in ERB in Rails?

<% %>
Executes the ruby code within the brackets.
<%= %>
Prints something into erb file.
<% -%>
Avoids line break after expression.
<%# %>
Comments out code within brackets; not sent to client (as opposed to HTML comments).

No comments:

Post a Comment