The rails link_to_if
function is great for, well, creating a link if and only if a condition is true. The prototype is
link_to_if(condition,
name,
options = {},
html_options = {},
*parameters_for_method_reference, &block)
Unfortunately, the default behavior is to put the link text on the page (with no link) if the condition is false. To rid yourself of the pesky text, so that nothing shows up if the condition is false, just add an empty block…
link_to_if(false, "Don't show me",a_fancy_url) {}
2 comments:
Thank you!
works great in firefox 3.01
IE7 prints an empty box space
I love IE7 ... not!
Post a Comment