2013-05-08 72 views
0

我有如下link_to標籤但我不知道如何添加html class屬性,並解釋我的代碼edit_course_path(course).. does。我是新來的軌如何在rails 2.3.5中添加類到link_to

<% @courses.each do |course| %> 
    <li class="list<%=cycle('odd', 'even')%>"> 
     <div class="category-edit"><%= link_to "#{t('edit_text')}", edit_course_path(course) if permitted_to? :edit, :courses %></div> 
     <div class="category-delete"> <%= link_to(t('delete_text'), course_path(course), :method => 'delete', :confirm => "#{t('delete_confirm_msg')}") if permitted_to? :destroy, :courses %></div> 
    </li> 
    <% end %> 

回答

0

一般來說,像這樣:

<% for employee in @employees %> 
    <%= link_to 'Edit', edit_employee_path(employee) if permitted_to? :update, employee , :class => 'some-class'%> 
<% end %> 
+0

沒有它不工作 – 2013-05-08 07:09:32

+0

我已經更新了我的代碼 – 2013-05-08 07:11:51

相關問題