Mateusz Urbański Mateusz Urbański - 4 days ago 6
HTML Question

Refactor haml to use rails link_to helper

I have the following haml markup:

%a.logo-text{href: "/surveys"}
%b Survey
Builder


Is there any way of rewriting this to use Ruby on Rails
link_to
helper?

Answer

You can pass a block to link_to helper:

= link_to "/surveys", class: "logo-text" do
  %b Survey
  Builder

or in one line:

= link_to "<b>Survey</b>Builder".html_safe, "/surveys", class: "logo-text" 
Comments