简体   繁体   中英

Ruby on Rails: how do I add an HTML class parameter to this link?

<% link_to :controller => :menu_bars, :action => :select do %>
    <div class="action_box right">
        Manage Menu Bars
    </div>
<% end %>

I've never been able to figure out the syntax for the documentation... so... here I am.

I want it to render something like <a ... class="myclass"> ...

<% link_to({:controller => :menu_bars, :action => :select}, :class => "myclass") do %>
    <div class="action_box right">
        Manage Menu Bars
    </div>
<% end %>


<a href="/countries/new" class="myclass">    
  <div class="action_box right">
    Manage Menu Bars
  </div>
</a>  

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM