ruby on rails - rendering a span inside of an anchor with link_to -


so want make text of link have bootstrap class of text-muted. if apply class directly anchor tag in link_to method of view, nothing. therefore, trying nest span anchor tag using link_to, html not render, when use raw method.

my end goal here make text within about linke have text-muted class, , have affects visible.

here code:

 1 <div class="row-fluid">                                                              2   <div class="vertical-center text-center">                                        3     <%= form_for :search, :html => { :class => "" } |f| %>                      4       <%= f.text_field :query, :placeholder => "job title" %><br />                  5       <%= f.text_field :location, :placeholder => "location" %><br />              6       <%= button_tag( :class => "submit-button btn btn-default", :id => "search") %>         7         <span class="text-muted bold">search</span>                                8       <% end %>                                                                      9       <%= link_to "#{ raw "<span class='text-muted bold'>about</span>" }", { :controller => :about }, :class => "btn btn-default bold", :id => "about"%>   10     <% end %>                                                                       11   </div>                                                                            12 </div>  

here looks on page: enter image description here

you can use html_safe:

"<span class='text-muted bold'>about</span>".html_safe 

or can use block:

<%= link_to about_path %>   <span class='text-muted bold'>about</span> <% end %> 

Comments