Michael Pavling wrote:
nobosh wrote:
doesn't have a simpilar
way to comment things out in the view.
Sure it does:
<%# comment %>
That won't help him comment his <td> though...
Of course it will. He can just put the whole <td> construct in an ERb
comment tag. ERb doesn't pay attention to HTML nesting. Or am I
misunderstanding what you're saying?
Or is this an issue of multiline comments in ERb? I font think it is,
but if so, then =begin or if false may be necessary.
You should probably be using Haml instead of ERb, though.
Why? What failure is the OP experiencing that HAML would make succeed?
Haml does have a nicer comment syntax, but I suggested it because it's
generally more pleasant to work with than ERb, not due to a "failure".
(BTW, I like HAML, but it's this sort of exclamation of yours without
any supporting citations that seems to rile people - try rephrasing
along the lines of "check out HAML for a more succinct and easier to
read way of rendering your views rather than using the bundled Erb"...
or something).
I and others have probably said that a hundred times in this list by
now. That's why we have archives...
Also, I didn't want to hijack the thread.
If there's a method in HAML that would allow him to
comment his <td> without a lot of fussing, show that too, since that's
the problem he's facing.
Now that would *really* be hijacking the thread.
Back to the OP:
I use a fairly straightforward way of removing code from execution, in
the view, model, controller, and in whatever language I happen to be
using - wrap it in a conditional check that doesn't return true:
<% if false %>
<td><%= link_to 'Destroy', project, :confirm => 'Are you
sure?', :method => :delete %></td>
<% end %>
Yes, that's a very useful trick.
Similarly, if you *never* want an existing conditional statement to
pass, use:
<% if false && <your original condition here> %>
and if you *always* want it to pass:
<% if true || <your original condition here> %>
...easy to add and easy to remove.
Cool!
Best,