我当前的代码如下所示:
<%= javascript_include_tag "hchq.js", "bootstrap-image-gallery.js", "bootstrap-image-gallery.min.js", "load-image.min.js", "media.js", "jquery", "bootstrap.js", "jquery.dataTables.js", "DT_bootstrap.js" %>
<%= javascript_include_tag :defaults %>
但是,我不断得到:
ActionController::RoutingError (No route matches [GET] "/assets/defaults.js"):
actionpack (3.2.8) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.8) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.8) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.8) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.1) lib/rack/lock.rb:15:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/static.rb:62:in `call'
railties (3.2.8) lib/rails/engine.rb:479:in `call'
railties (3.2.8) lib/rails/application.rb:223:in `call'
rack (1.4.1) lib/rack/content_length.rb:14:in `call'
railties (3.2.8) lib/rails/rack/log_tailer.rb:17:in `call'
rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service'
/usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
/usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
/usr/local/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
深入研究我发现的问题:Rails 3.1rc4 defaults.js not found建议我删除默认值。我把它拿出来,404 消失了,但是随着它的进出,我无法发出删除请求。它只是将我引导到显示页面。
关于发生了什么以及如何解决这个问题的任何想法,所以我没有得到 404 并且可以发出删除请求?
更新:
这是实际的删除链接:<%= link_to 'Delete', client_path(client), method: "delete", class: "label label-important" %>
它会生成以下 html:<a href="/clients/2" class="label label-important" data-method="delete" rel="nofollow">Delete</a>
这对我来说似乎是正确的。
这是日志中的一行:
Started GET "/clients/2" for 127.0.0.1 at 2012-09-27 16:50:23 -0500
Processing by ClientsController#show as HTML
Parameters: {"id"=>"2"}
Client Load (0.3ms) SELECT "clients".* FROM "clients" WHERE "clients"."id" = ? LIMIT 1 [["id", "2"]]
Rendered clients/show.html.erb within layouts/application (1.2ms)
Completed 200 OK in 47ms (Views: 45.4ms | ActiveRecord: 0.3ms)
Started GET "/assets/defaults.js" for 127.0.0.1 at 2012-09-27 16:50:23 -0500
Served asset /defaults.js - 404 Not Found (4ms)
我尝试的另一件事是摆脱默认行,因为那是 pre-rails 3.1,并使用“应用程序”作为 javascript_include_tag 中唯一的东西,我仍然有这个问题。