Ruby on rails :确认!在Rails应用程序中被忽略?

Ruby on rails :确认!在Rails应用程序中被忽略?,ruby-on-rails,ruby,html,oop,Ruby On Rails,Ruby,Html,Oop,我正在运行一个Rails应用程序,除了一小部分代码外,它运行得很好。 当我单击“销毁”时,我需要浏览器请求批准,但它没有。 这是我在index.html.erb <td><%= button_to 'Destroy', {:action => 'destroy', :id => publisher}, {:method => :delete, :confirm => 'Are you sure?'} %></td> 'destroy'

我正在运行一个Rails应用程序,除了一小部分代码外,它运行得很好。
当我单击“销毁”时,我需要浏览器请求批准,但它没有。
这是我在
index.html.erb

<td><%= button_to 'Destroy', {:action => 'destroy', :id => publisher},
{:method => :delete, :confirm => 'Are you sure?'} %></td>
'destroy',:id=>publisher},
{:method=>:delete,:confirm=>'你确定吗?}%>
我找不到语法有任何错误,也找不到任何建议说明此操作不起作用的原因

请提供帮助?

请尝试以下语法

<%= button_to "Destroy", { :action => "delete", :id => publisher }, :confirm => "Are you sure?", :method => :delete %>
“删除”,:id=>publisher},:confirm=>“确定吗?”,:method=>:delete%>
确保在布局文件中包含Javascript库:

<%= javascript_include_tag :defaults %>

如果以上两项都不起作用,请发布完整视图并解释如何定义路线

谢谢

请注意,和您应该使用

<%= button_to 'Destroy', {:action => 'destroy', :id => publisher},
{:method => :delete, :data => { :confirm => 'Are you sure?'}} %>
'destroy',:id=>publisher},
{:method=>:delete,:data=>{:confirm=>'你确定吗?'}}%>

我觉得自己真的很愚蠢……错误是我忘记了布局中的
…谢谢:(知道这一点非常有用,非常感谢,我会尝试在将来替换它。考虑到它不能解决你的问题,我觉得答案不应该被否决,艾米。它确实有助于知道接下来会发生什么;在我看来,这很值得表决;-)看起来有个打字错误。不应该:data是data:per?似乎有一个拼写错误,但不是你指出的那个,@JohnCreamer,我已经纠正了