在我开这篇文章之前,我在stackoverflow上阅读了很多帖子,我尝试了解决方案......
自: Ruby on Rails: Why the confirmation message does not appear in "link_to('delete', ...)"?
和 Ruby on Rails: Why the confirmation message does not appear in "link_to('delete', ...)"?
我真的很困惑,因为按照本书的教程 https://www.railstutorial.org/book/toy_app
但我有另一个版本,其中toy_app被称为demo_app
我不知道这是否是兼容性问题,但几乎每一步我都需要研究解决一个配置错误......你知道,更改sqlite3-ruby for sqlite等等......
现在我遇到了与其他人相同的问题,Ruby On Rails中的Destroy Function不起作用,我尝试了各种解决方案而且无法实现。
我的配置是: Windows 7 64位 Rails 3.2.19 Ruby 1.9.3
HTML销毁代码是:
<td><a href="/users/1" data-confirm="Are you sure?" data-method="delete" rel="nofollow">Destroy</a></td>
我的application.html.erb是
<!DOCTYPE html>
<html>
<head>
<title>DemoApp</title>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= javascript_include_tag 'jquery_ujs' %>
<%= csrf_meta_tags %>
</head>
<body>
<%= yield %>
</body>
</html>
application.js看起来像
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
// GO AFTER THE REQUIRES BELOW.
//
= require jquery
= require jquery_ujs
//= require_tree .
我检查了Chrome和Internet Explorer,并且两者都启用了Javascript ...
我还能做些什么?
由于