Ruby on rails Rails 3:链接到列表项?
我有一些按钮基本上被CSS覆盖了。我想将整个Ruby on rails Rails 3:链接到列表项?,ruby-on-rails,ruby-on-rails-3,Ruby On Rails,Ruby On Rails 3,我有一些按钮基本上被CSS覆盖了。我想将整个链接链接到Rails操作 所以我不想这样做: <li><%= link_to choice, { :action => "update", :id => @id, :response => index }, :remote => true %></li> 更新“,:id=>@id,:response=>index},:remote=>true%> 我想这样做: <%= link_to
链接链接到Rails操作
所以我不想这样做:
<li><%= link_to choice, { :action => "update", :id => @id, :response => index }, :remote => true %></li>
更新“,:id=>@id,:response=>index},:remote=>true%>
我想这样做:
<%= link_to <li>choice</li>, { :action => "update", :id => @id, :response => index }, :remote => true %>
“更新”,:id=>@id,:response=>index},:remote=>true%>
使用html\u安全
<%= link_to "<li>choice</li>".html_safe, { :action => "update", :id => @id, :response => index }, :remote => true %>
“更新”,:id=>@id,:response=>index},:remote=>true%>
使用块
<%= link_to {...} do %>
<li>choice</li>
<% end %>
选择
请注意,rails 3.x使用了
,因为answers使用了标记格式。您需要选择HTML代码,然后按{}
按钮才能正确显示。谢谢您的回答!工作得很好!你为什么不使用路由助手来生成URL?我对Rails非常陌生,所以我不使用它们的唯一原因是我不知道这是什么:)快速注意:块格式根据使用的构造类型而不同。例如,链接到将使用
,但如果仍然使用