:使用Rails 3和jQuery UJS时,Rails中的确认选项被忽略 [英] :confirm option in Rails being ignored while using Rails 3 and jQuery UJS

查看:57
本文介绍了:使用Rails 3和jQuery UJS时,Rails中的确认选项被忽略的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Rails应用程序中有一个项目表,每个项目都有一个删除链接,如下所示:

I've got a table of projects in my Rails app, each with a delete link, like so:

<%= link_to删除,项目,:confirm => 你确定吗?,:method => :delete%>

但是,即使用户在对话框中单击取消,也会发送删除请求。

However, the delete request is sent even if the user clicks "Cancel" on the dialog box.

有关如何解决此问题的任何想法?我正在使用Rails 3,Beta 3,jQuery库和附带的jQuery UJS库。

Any ideas on how to fix this? I'm using Rails 3, Beta 3, with the jQuery library and accompanying jQuery UJS library.

推荐答案

你需要得到一个更新版本的rails.js。我使用相同的设置遇到了同样的问题。当我对旧版本和新版本进行区分时,我发现旧版本中的确认处理程序已被注释掉。新版本解决了这个问题。

You need to get a more recent version of rails.js. I was having the same problem using the same setup you have. When I diff'd the old and new versions, I discovered the confirmation handler in the old version was commented out. The new version solves the problem.

这篇关于:使用Rails 3和jQuery UJS时,Rails中的确认选项被忽略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆