supersize supersize - 3 months ago 6x
HTML Question

How to add inline styles to description of Rails link_to

I'm fairly new to Rails development, and would like to know how I can add inline styles to a

method like so:

= link_to "<b>menu<b> link", args, class: 'button'

I would like to make the word
bold. How can achieve this?


Just call .html_safe on the name string:

= link_to "<b>menu<b> link".html_safe, args, class: 'button'

This allows the tags to be rendered as HTML instead of being escaped.