Web开发敏捷之道P81页的delete错误:
原文代码:
<%= link_to 'Destroy', { :action => 'destroy', :id => product },
:confirm => "Are you sure?",
:method => :post %>
代码删除是不能实现的。
正确的代码应该是:
<%= link_to 'Destroy', { :action => 'destroy', :id => product },
:confirm => "Are you sure?",
:method => :delete %>
原文代码:
<%= link_to 'Destroy', { :action => 'destroy', :id => product },
:confirm => "Are you sure?",
:method => :post %>
代码删除是不能实现的。
正确的代码应该是:
<%= link_to 'Destroy', { :action => 'destroy', :id => product },
:confirm => "Are you sure?",
:method => :delete %>
本文纠正了Web开发敏捷之道一书中关于Rails框架内delete操作的一个错误。原书中使用了:post方法,实际上应该使用:delete方法来正确执行资源的删除操作。
386

被折叠的 条评论
为什么被折叠?



