2

我想在销毁控制器中的对象之前添加一个确认框。基本上,创建

data: {confirm: "You sure" }

但在控制器中object.destroy谢谢

4

2 回答 2

3

you can only interact with the user in the view layer, so you need to make that confirmation before you go into the destroy method

于 2013-08-14T16:41:59.967 回答
0

You can warn the user by simply add the confirm option to the link, and it will pop up a window to notify the user, same as using alert function in javascript.

<%= link_to 'delete', delete_obj_path(obj), :method=>'delete', :confirm=>'You sure?'%>

于 2013-08-14T16:51:35.373 回答