# Block comment in rhtml file

**URL:** <https://www.ruby-forum.com/t/block-comment-in-rhtml-file/88529>\
**Category:** Rails\
**Created:** [March 12, 2007, 12:15pm UTC](https://www.ruby-forum.com/t/block-comment-in-rhtml-file/88529 "2007-03-12T12:15:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 12, 2007, 12:15pm UTC](https://www.ruby-forum.com/t/block-comment-in-rhtml-file/88529/1 "2007-03-12T12:15:15Z")

</div>

Hi all,

Is there tags for block comment in rhtml, so that I can comment out a  
block of code (mainly for testing/debuging)?

 html comment can't prevent ERb code from processed

\<%# text inside become comment %\> only comment out the the tag

It’s quite inconvenient not to have such facility.

Thanks,

- Chuong

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 12, 2007, 12:20pm UTC](https://www.ruby-forum.com/t/block-comment-in-rhtml-file/88529/2 "2007-03-12T12:20:15Z")

</div>

removed\_email\_address@domain.invalid wrote:

> Hi all,
> 
> Is there tags for block comment in rhtml, so that I can comment out a  
> block of code (mainly for testing/debuging)?
> 
> html comment can't prevent ERb code from processed
> 
> \<%# text inside become comment %\> only comment out the the tag
> 
> It’s quite inconvenient not to have such facility.

You mean like:

\<% if false -%\>  
…everything skipped…  
\<% end -%\>

?

–  
Michael W.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 13, 2007, 4:22am UTC](https://www.ruby-forum.com/t/block-comment-in-rhtml-file/88529/3 "2007-03-13T04:22:06Z")

</div>

Hi Michael,

It’s something like that, but your suggestion is just a workaround.  
There’s no built-in in rhtml to do this? I want the editor to mark it  
as comment also.

In Java JSP files, you have \<%-- comment --%\>

However your way is useful at some level.

Thanks,

- Chuong

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 14, 2007, 5:09am UTC](https://www.ruby-forum.com/t/block-comment-in-rhtml-file/88529/4 "2007-03-14T05:09:32Z")

</div>

Grant Gelinas-Brown wrote:

> I believe
> 
> =begin %\>
> 
> \<% your ruby code here %\>  
> \<% and some more %\>
> 
> =end %\>
> 
> will work. Make sure the ‘=’ sign is the first thing on a line.

Nope, doesn’t work.

–  
Michael W.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 14, 2007, 4:52am UTC](https://www.ruby-forum.com/t/block-comment-in-rhtml-file/88529/5 "2007-03-14T04:52:30Z")

</div>

I believe

=begin %\>

\<% your ruby code here %\>  
\<% and some more %\>

=end %\>

will work. Make sure the ‘=’ sign is the first thing on a line.

Grant

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 14, 2007, 5:26am UTC](https://www.ruby-forum.com/t/block-comment-in-rhtml-file/88529/6 "2007-03-14T05:26:33Z")

</div>

On 3/12/07, removed\_email\_address@domain.invalid [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> It’s something like that, but your suggestion is just a workaround.  
> There’s no built-in in rhtml to do this? I want the editor to mark it  
> as comment also.
> 
> In Java JSP files, you have \<%-- comment --%\>
> 
> However your way is useful at some level.

\<%#

This \<%= does %\>n't work?

%\>

jeremy
