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 %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With