我正在使用rails beta 3,並且我有一個名爲index.html.erb的erb頁面用於討論控制器。在該頁面中,我有一個鏈接如下:REST銷燬鏈接生成問題
<%= link_to 'Delete', {:action=>'destroy', :id=>@discussion}, :confirm=>"Are you sure", :method=>'post' %>
這應該產生一個鏈接刪除討論,但是,生成HTML是
<a href="/discussions/1" data-confirm="Are you sure" data-method="post" rel="nofollow">Delete</a>
總是路由到show動作。我認爲href應該是/ discuss/destroy/1。但由於某種原因,事實並非如此。
任何想法?提前致謝。
這有效!非常感謝,麥克! – Wei 2010-04-02 19:29:26
更新後的鏈接:http://blog.loopedstrange.com/modest-rubyist-archive/rails-3-ujs-and-csrf-meta-tags – Eric 2012-12-03 18:42:14