在嵌入式ruby中指定link_to的类

时间:2012-05-16 03:48:15

标签: ruby-on-rails

我如何指定:class => “”这里?:

<li><%= link_to "#" current_user  %></li>

TY

2 个答案:

答案 0 :(得分:2)

<li><%= link_to "#", current_user, :class => "class-name"  %></li>

答案 1 :(得分:1)

检查以下内容,

 <%= link_to "Articles", articles_path, :id => "news", :class => "article" %>
   # => <a href="/articles" class="article" id="news">Articles</a>

有关详情,请查看: - http://apidock.com/rails/ActionView/Helpers/UrlHelper/link_to