Last Updated: September 09, 2019
·
8.651K
· robwilliamsuk

Comment out multiple lines in erb

Sometimes when rewriting an erb template you want the original content easy to hand but not rendered in the view. Wrap it in a condition you know will always return false and it won't be. Simple but effective.

<h1>New lovely heading tag</h3>

<% if false %>
  <h3>Old horrible heading tag with a <%= hard_to_remember_variable %></h3>
<% end %>

http://stackoverflow.com/questions/3127644/block-comments-in-html-erb-templates-in-rails

2 Responses
Add your response

AMAZING

over 1 year ago ·

@RichGuk I sense sarcasm :)

over 1 year ago ·