Commenting out chunks of view

December 14, 2009 at 3:33 pm Leave a comment

It’s not as easy to comment out big chunks of Rails erb (view) code. Here’s the one that seems to work fine for people:

<% if false %><!-- comment start -->
<% ... some code ... %>
some html
<% ... more code ... %>
<!-- comment end --><% end %>

If you simply try using HTML comments, the code will still execute.

Finally, if you want to simply comment out a single ERB statement, put # just after <%, like this:

<%# some ror code here %>
<%#= or some talking ror code here %>

Entry filed under: Uncategorized.

Upgrading the script/console in Windows VISTA environment RubyInstaller RC1 is out

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed

Recent posts

Starting to learn Rails?


Get Kindle - the best e-book reader, that I personally use, and the only one that you can read on the beach - very useful: Kindle Wireless Reading Device (6" Display, Global Wireless, Latest Generation)

%d bloggers like this: