Rails 3:Link_to列表项?

Der*_*rek 4 ruby-on-rails ruby-on-rails-3

我有一些基本上<li>用CSS 重写的按钮.我想将整个<li>链接链接到Rails操作.

所以我不想这样做:

<li><%= link_to choice, { :action => "update", :id => @id, :response => index }, :remote => true %></li>
Run Code Online (Sandbox Code Playgroud)

我想做这样的事情:

<%= link_to <li>choice</li>, { :action => "update", :id => @id, :response => index }, :remote => true %>
Run Code Online (Sandbox Code Playgroud)

Shi*_*Ray 8

使用块

<%= link_to {...} do %>
  <li>choice</li>
<% end %>
Run Code Online (Sandbox Code Playgroud)

请注意rails 3.x使用<%=但2.x使用rails<%