0
我有這樣一個的link_to:爲什麼我不能直接改變link_to成爲link_to remote?
<%= link_to 'X', category, :confirm => 'Are you sure?', :method => :delete %>
所以,我改變這樣的:
<%=link_to_remote category.name,
:confirm => 'Are you sure?', :method => :delete%>
它顯示確認框,但我點擊「是」後,不會刪除我想要的物品,爲什麼?
,因爲這種方法是在/視圖/存儲調用,它不調用/視圖/類,所以,我有這樣的錯誤發生,我怎麼能添加「delete_category_path」在商店# NoMethodError管理 顯示app/views/store/manage.html.erb其中第13行出現: 未定義方法delete_category_path用於# –
DNB5brims
2010-01-12 15:41:49
上面的答案假設您已將類別定義爲資源config/routes.rb文件。這樣做會添加* _path和* _url輔助方法,包括'delete_category_path' – 2010-01-12 17:07:19
感謝Ben 也可以使用:url => {:action =>「...」,:controller =>「... 「}形式 – 2010-01-12 17:19:04