Does it have something to do with output?
So, <%= ...code... %> is used for outputting after code is executed, and <% ...code... %> is only used for executing the code?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is ERB templating markup (one of many templating languages supported by Rails). This markup:
is used to evaluate a Ruby expression. Nothing is done with the result of that expression, however. By contrast, the markup:
does the same thing (runs whatever Ruby code is inside there) but it calls
to_son the result and replaces the markup with the resulting string.In short:
For example:
In contrast, here’s some Haml markup equivalent to the above: