20

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.

Community
  • 1
  • 1
Bob
  • 8,424
  • 17
  • 72
  • 110

1 Answers1

33

Using the dash removes the whitespace around the ERB tag, there is a RailsCast that talks about this and some other View tricks.

Mike Buckbee
  • 6,793
  • 2
  • 33
  • 36
  • 9
    As of rails v4.2.1, <% %> and <%- -%> are the same. http://apidock.com/rails/v4.2.1/ActionView/Base – Yeonho Sep 02 '15 at 09:38