supersize supersize - 1 year ago 120
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?

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download