Using content_tag to underline part of a string

842 Views Asked by At

Currently I am using content_tag in my controller helper to reduce a lot of the logic that was being performed in the view. I understand getting nested content_tags to work but the one thing that keeps hanging me up is if I had the following

<div id="content"><u>Click here</u> to unlock</div>

then how could i do this using content_tag or is there a better way?

1

There are 1 best solutions below

0
On BEST ANSWER

Try this

content_tag(:div, content_tag(:u, 'Click here') + ' to unlock', id: 'content')