Rails - Ability to Enable/Disable Links on a View?

Posted by AnApprentice on Stack Overflow See other posts from Stack Overflow or by AnApprentice
Published on 2011-01-05T04:42:24Z Indexed on 2011/01/05 4:53 UTC
Read the original article Hit count: 234

Hello, I have a UserMailer View that has several link_to's like so:

<%= link_to('XXXXXXXX Link Title', item_url(@item, :only_path => false), :style => 'color:#5196E3;text-decoration:underline;') %>

The page has several different links. I'd like to know if there is a way to globally set in the view to enable or disable the links.

If enabled, the above would run like normal, if not the block above would just show the text (XXXXXXXX Link Title) and not be linked?

Any ideas other than wrapping every link_to inside a IF statement?

Thanks

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby-on-rails3