我想在销毁控制器中的对象之前添加一个确认框。基本上,创建
data: {confirm: "You sure" }
但在控制器中object.destroy
谢谢
我想在销毁控制器中的对象之前添加一个确认框。基本上,创建
data: {confirm: "You sure" }
但在控制器中object.destroy
谢谢
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
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?'%>