Rails - conditional html attributes
Looking around the docs I cannot see a correct way to go about this. Here's an example using un-refactored code:


    = link_to user.name, user, :meta => "#{user.public? ? '' : 'nofollow noindex'}"

Now this could be the same with any html attribute the result being I don't have valid xhmtl due to empty tag in the case of the condition not passing.

    <a href='/users/mark' meta=''>Mark</a>

How can I make the attribute definition conditional, not just it's value.

Rails - conditional html attributes
===

Looking around the docs I cannot see a correct way to go about this. Here's an example using un-refactored code:


    = link_to user.name, user, :meta => "#{user.public? ? '' : 'nofollow noindex'}"

Now this could be the same with any html attribute the result being I don't have valid xhmtl due to empty tag in the case of the condition not passing.

    <a href='/users/mark' meta=''>Mark</a>

How can I make the attribute definition conditional, not just it's value.
