What the difference between
<% some code %>
and
<%= some code %>
in RoR?
What the difference between
<% some code %>
and
<%= some code %>
in RoR?
Think of it like this:
<% execute this code and display nothing %>
and
<%= execute this code and display the result in the view %>
So, for example you could do this:
<% @values = ['eenie', 'menie', 'miney', 'mo' ] %>
<% @values.each do |value| %>
The current value is <%= value %>!
<% end %>
<%= some code %>
will evaluate the statement and display it in the view.
<% some code %>
will only evaluate the statement.