RoR新手在这里。在Agile Web Dev with Rails的第9章结束时使用“play time”练习。无法获取link_to_remote以在部分中为我生成链接。我store_cart_item.html.erb部分看起来像这样:Rails link_to_remote无法渲染,为什么?
<% if cart_item == @current_item then %>
<tr id="current_item">
<% else %>
<tr>
<% end %>
<td>
<!-- stuck here, trying to get a link to decrement the quantity, but it doesn't
even show a link, I also tried nesting a link_to in form_remote_tag which
at least displayed link but didn't call the remove_from_cart action -->
<% link_to_remote cart_item.quantity.to_s + "×",
:update => "cart",
:url => {:action => "remove_from_cart", :id => cart_item.product} %>
</td>
<td><%= h cart_item.title %></td>
<td class="item-price"><%= number_to_currency(cart_item.price) %></td>
</tr>
在浏览器中,link_to_remote似乎无所事事,B/C HTML输出如下:
<tr>
<td>
<!-- stuck here, trying to get a stupid link to decrement the quantity, doesn't even show link
also tried nesting it in form_remote_tag which at least displayed link but didn't call the
remove_from_cart action -->
</td>
<td>Agile Web Development with Rails</td>
<td class="item-price">$68.85</td>
</tr>
感觉就像我错过了非常明显的事情我究竟做错了什么?
哦,我觉得像这样的混日子。谢谢您的帮助。 – Marvin 2010-07-17 22:24:54