Forum: Ruby on Rails How to comment a block of code in RHTML file.

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ed81ae15240e5a43049ffa51e64d9b67?d=identicon&s=25 Lalit (Guest)
on 2007-05-21 08:52
(Received via mailing list)
Hi Group.

I am just starting with Ruby on Rails. I have been stuck up (not
exactly stuck up but I need to figure this out). I need to comment a
block of code with HTML and RUBY code. Is there any way of commenting
an entire block of code?

Example:
<div id=<%="comment-#{comment.id}"%> class="s_view_comments_row">
<div class="s_view_user_thumbnail">
<%if comment.user.photo_exists?%>
</div><!--END s_view_user_thumbnail-->

How do I comment these 4 lines so that they are not executed when
the .rhtml is parsed.

Lalit
40db9e75b3f5899258e3bdc0c9210154?d=identicon&s=25 Conrad Taylor (Guest)
on 2007-05-21 09:00
(Received via mailing list)
Hi you can do one of the follow:

<!-- add you comment here -->

or

<%# add your commt here -->

Good luck,

-Conrad
3642abdf8fb9e36b560784f4cb676529?d=identicon&s=25 guo william raym (Guest)
on 2007-05-21 09:06
(Received via mailing list)
has there shortcut?
F15cd004b8f180465f9f2d856336ade9?d=identicon&s=25 inung (Guest)
on 2007-05-21 09:23
(Received via mailing list)
what shortcut? your IDE's one?

On 21/05/07, guo william raym <williamraym@gmail.com> wrote:
> > or
> > >
> > >
> >
>
> >
>


--
in03ng a.k.a inung a.k.a nursamsi a.k.a nur syamsi
Y! in03ng
821395fe70906c8290df7f18ac4ac6cf?d=identicon&s=25 Rick Olson (Guest)
on 2007-05-21 15:57
(Received via mailing list)
On 5/21/07, Lalit <lalitpatel@gmail.com> wrote:
> <div class="s_view_user_thumbnail">
> <%if comment.user.photo_exists?%>
> </div><!--END s_view_user_thumbnail-->
>
> How do I comment these 4 lines so that they are not executed when
> the .rhtml is parsed.

AFAIK erb has no block commenting syntax.  Here's what I usually do
though:

<% if false -%>
  <div>....
<% end -%>

--
Rick Olson
http://lighthouseapp.com
http://weblog.techno-weenie.net
http://mephistoblog.com
This topic is locked and can not be replied to.