0

我有以下 link_to 标签但我不知道如何向它添加 html 类属性并向我解释代码 edit_course_path(course) .. 确实如此。我是 Rails 新手

  <% @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 %>
4

1 回答 1

0

一般是这样的:

<% for employee in @employees %>
   <%= link_to 'Edit', edit_employee_path(employee) if permitted_to? :update, employee , :class => 'some-class'%>
<% end %>
于 2013-05-08T07:02:47.607 回答