Rails ERB <%- ... -%> vs. <% ... %>

Bob picture Bob · Oct 7, 2009 · Viewed 13.1k times · Source

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.

Answer

Mike Buckbee picture Mike Buckbee · Oct 7, 2009

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