Erin Mulder on 22 Nov 2005 00:47:51 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PhillyOnRails] Random tip of the day


Brian Buckley wrote:
>>Random tip of the day...
> 
> <%
> =begin
> This style will work with scriplets too  <%= now.broken.function(foo) %>
> =end
> %>
> 
> <% if false %>
> so will this style <%= now.b>roken.function(foo) %>
> <% end %>
> 
> FYI,  I am getting compile errors in the above commented-out scriplets
> so I am thinking the scriplets have to be valid at some level in order
> for this tip to work.   We can't just comment out junk scriplets and
> have them ignored.  I hope I am wrong.

In the second case, I think the commented out stuff needs to be valid
enough for it to detect where the end statement is without running into
errors.  Thus, you won't get dinged for calling nonexistent methods, but
you can't give it totally broken code.  (I guess I should have used a
better example, eh?  Sorry!)

The first one should theoretically work in all cases (unless you are
trying to commend out a line whose contents are "=end").  However, I
must admit that since I posted about it, I've had trouble getting it to
work consistently in ERb templates.  Sometimes it seems to work right
and sometimes it barfs at me.  Not yet sure why. :(

Cheers,
Erin
_______________________________________________
talk mailing list
talk@phillyonrails.org
http://lists.phillyonrails.org/mailman/listinfo/talk