0
<%= -%>
<%= %>

I am confused about this. Anyone can tell me details? Thank you in advance.

Daniel
  • 732
  • 2
  • 6
  • 17

1 Answers1

2

<%= %> 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?

Community
  • 1
  • 1
Rajdeep Singh
  • 16,466
  • 6
  • 45
  • 69
  • Thank you but I tried to iterate an array in both ways they generate the same html source code. – Daniel Nov 03 '14 at 07:20