Add css class to rails link_to helper

后端 未结 5 2026
星月不相逢
星月不相逢 2020-12-24 10:43

I\'m trying to style a rails link using css using the following code:

<%= link_to \"Learn More\", :controller => \"menus\", :action => \"index\", :         


        
5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-24 11:08

    if you do not have a controller action / route necessary for the link, you can pass nil as the placeholder and get the classes to apply as necessary

    <%= link_to 'link verbiage', nil,  class: 'classes for action tag'%>
    

提交回复
热议问题