Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Avoid rendering comments in HTML

I have a lot of comments in Rails views.

How i can prevent rendering them ?

like image 316
AntonAL Avatar asked Aug 07 '10 23:08

AntonAL


2 Answers

If I understand the question correctly, you're asking about Ruby/Rails comments vs HTML comments... Give this a try in your view:

<!-- This is an HTML comment and will show up in the HTML source! -->

Now try this:

<%# This is a comment that won't show up in the HTML source! %>
<%# 
    You can even use this for commenting multiple lines!
    How useful!
%>

Does that help?

like image 194
harrymasson Avatar answered Sep 30 '22 22:09

harrymasson


use =begin and =end to mark the beginning and end of your comment

like image 22
Nealv Avatar answered Sep 30 '22 23:09

Nealv