Rails: difference between <%= and <%==? [duplicate] - ruby-on-rails

This question already has answers here:
What does <%== %> do in rails erb?
(2 answers)
Closed 9 years ago.
I'm looking at legacy code that has all erb interpolations with <%== ... And I've never used that before.
What is it for? What does it do differently from <%= ?

It's shorthand to output raw content.
see https://stackoverflow.com/a/5533614/2128691
<%== #content.body %>
Is exactly the same as
<%= raw #content.body %>

Related

Ruby on Rails: What does "<%" and "<%=" mean? [duplicate]

This question already has answers here:
What is the difference between <%, <%=, <%# and -%> in ERB in Rails?
(7 answers)
Closed 7 years ago.
What are the differences between "<%" and "<%="? How do you know which to use? I'm teaching myself and one of the tutorials I'm using listed the above symbol sets.
You must use <%= %> for instructions whose output you want to display in your view, and use <% %> otherwise.
<%= %> use to output something
<% %> use to add your conditions for example

difference between <% and <%= ruby [duplicate]

This question already has answers here:
Difference between "<%=" and "<%" when mixing ruby with html?
(2 answers)
Closed 7 years ago.
I've been working through some ruby on rails tutorials, and I see that the <% %> and <%= %> symbols are used for inline ruby, but what is the difference between those two pairs of symbols?
They are generally used in embedded ruby (erb) files.
<% %> is to execute the Ruby code within brackets, <%= %> is to print output in the file.

What is the difference between these two symbols in rails [duplicate]

This question already has answers here:
What is the difference between <%, <%=, <%# and -%> in ERB in Rails?
(7 answers)
Closed 8 years ago.
<%= -%>
<%= %>
I am confused about this. Anyone can tell me details? Thank you in advance.
<%= %> prints something into ERB template
<%= -%> prints something into ERB template and avoids line break after expression.
Take a look here for details Why many people use "-%>" instead of "%>" in Rails?

embedded ruby syntax "<%= .. %>" in rails [duplicate]

This question already has answers here:
What is the difference between <%, <%=, <%# and -%> in ERB in Rails?
(7 answers)
<% %>(without equal) in ruby erb means? [duplicate]
(3 answers)
Closed 8 years ago.
Am I correct with the idea below regarding ERB template? any advice would be really appreciated.
Is the embedded ruby syntax with an equal sign "<%= %>" intended to render some output? while the one without the equal sign "<% %>" doesn't.
When you use <%= %> you render the expression value to your output. While <% %> is simply to write some Ruby code that won't be rendered to final output.

Rails ERB <%- ... -%> vs. <% ... %> [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Difference between -%> and %> in rails
So for an ERB file, what's the difference between <%- ... -%> vs. <% ... %>? As far as I can tell, they serve the same purpose but one requires more typing than the other.
Using the dash removes the whitespace around the ERB tag, there is a RailsCast that talks about this and some other View tricks.

Resources