我是rails(以及stackoverflow,整个rails堆栈和命令行编程)的新手。
我从railsinstaller.org在Rails 4.1上安装了Ruby 2.1.5,并且一直在尝试按照教程:http://guides.rubyonrails.org/getting_started.html
除了删除方法之外,我已经完成了所有工作。在尝试教程之后,我读了一个建议使用button_to而不是link_to的论坛。此更改允许删除工作,但我无法生成身份验证框(用户无需身份验证即可删除)。我从研究中得知,至少有一个潜在的问题是jquery,但我不知道如何使用我的项目。我试过运行rails generate jquery:install
,这使我的代码无法修复;我不得不重新启动。
我已经在下面插入了错误代码..我猜我一定是个错误,或者是我使用Windows的问题。任何帮助将不胜感激,谢谢。
Started DELETE "/articles/2/comments/5" for 127.0.0.1 at 2015-02-17 23:00:38 -08
00
Processing by CommentsController#destroy as HTML
Parameters: {"authenticity_token"=>"hCfYSLj1BoYcIGFK4bDrfdbBJo2rGT9WC6o0AR42Hn
0=", "article_id"=>"2", "id"=>"5"}
Article Load (2.5ms) SELECT "articles".* FROM "articles" WHERE "articles"."
id" = ? LIMIT 1 [["id", 2]]
Comment Load (0.0ms) SELECT "comments".* FROM "comments" WHERE "comments"."
article_id" = ? AND "comments"."id" = ? LIMIT 1 [["article_id", 2], ["id", 5]]
(0.0ms) begin transaction
SQL (2.5ms) DELETE FROM "comments" WHERE "comments"."id" = ? [["id", 5]]
(27.5ms) commit transaction
Redirected to http://localhost:3000/articles/2
Completed 302 Found in 60ms (ActiveRecord: 32.5ms)
Started GET "/articles/2" for 127.0.0.1 at 2015-02-17 23:00:38 -0800
Processing by ArticlesController#show as HTML
Parameters: {"id"=>"2"}
Article Load (0.0ms) SELECT "articles".* FROM "articles" WHERE "articles"."
id" = ? LIMIT 1 [["id", 2]]
Comment Load (0.0ms) SELECT "comments".* FROM "comments" WHERE "comments"."a
rticle_id" = ? [["article_id", 2]]
Rendered collection (0.0ms)
Rendered comments/_form.html.erb (10.0ms)
Rendered articles/show.html.erb within layouts/application (95.0ms)
Completed 200 OK in 225ms (Views: 220.0ms | ActiveRecord: 0.0ms)
Started GET "/stylesheets/defaults.css" for 127.0.0.1 at 2015-02-17 23:00:38 -08
00
ActionController::RoutingError (No route matches [GET] "/stylesheets/defaults.cs
s"):
actionpack (4.1.8) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `c
all'
actionpack (4.1.8) lib/action_dispatch/middleware/show_exceptions.rb:30:in `ca
ll'
railties (4.1.8) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.1.8) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.1.8) lib/active_support/tagged_logging.rb:68:in `block in tag
ged'
activesupport (4.1.8) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.1.8) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.1.8) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.1.8) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
rack (1.5.2) lib/rack/runtime.rb:17:in `call'
activesupport (4.1.8) lib/active_support/cache/strategy/local_cache_middleware
.rb:26:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
actionpack (4.1.8) lib/action_dispatch/middleware/static.rb:84:in `call'
rack (1.5.2) lib/rack/sendfile.rb:112:in `call'
railties (4.1.8) lib/rails/engine.rb:514:in `call'
railties (4.1.8) lib/rails/application.rb:144:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
rack (1.5.2) lib/rack/content_length.rb:14:in `call'
rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `servi
ce'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/webrick/server.rb:295:in `block in
start_thread'
Rendered C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.1.8
/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (2.5ms)
Rendered C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.1.8
/lib/action_dispatch/middleware/templates/routes/_route.html.erb (7.5ms)
Rendered C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.1.8
/lib/action_dispatch/middleware/templates/routes/_table.html.erb (5.0ms)
Rendered C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.1.8
/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb within
rescues/layout (147.5ms)
Started GET "/javascripts/applications.js" for 127.0.0.1 at 2015-02-17 23:00:39
-0800
[2015-02-17 23:00:39] ERROR Errno::ECONNABORTED: An established connection was a
borted by the software in your host machine. @ io_fillbuf - fd:6
C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/webrick/httpserver.rb:80:in `
eof?'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/webrick/httpserver.rb:80:in `
run'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/webrick/server.rb:295:in `blo
ck in start_thread'
ActionController::RoutingError (No route matches [GET] "/javascripts/application
s.js"):
actionpack (4.1.8) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `c
all'
actionpack (4.1.8) lib/action_dispatch/middleware/show_exceptions.rb:30:in `ca
ll'
railties (4.1.8) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.1.8) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.1.8) lib/active_support/tagged_logging.rb:68:in `block in tag
ged'
activesupport (4.1.8) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.1.8) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.1.8) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.1.8) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
rack (1.5.2) lib/rack/runtime.rb:17:in `call'
activesupport (4.1.8) lib/active_support/cache/strategy/local_cache_middleware
.rb:26:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
actionpack (4.1.8) lib/action_dispatch/middleware/static.rb:84:in `call'
rack (1.5.2) lib/rack/sendfile.rb:112:in `call'
railties (4.1.8) lib/rails/engine.rb:514:in `call'
railties (4.1.8) lib/rails/application.rb:144:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
rack (1.5.2) lib/rack/content_length.rb:14:in `call'
rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `servi
ce'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run'
C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/webrick/server.rb:295:in `block in
start_thread'
Rendered C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.1.8
/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (5.0ms)
Rendered C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.1.8
/lib/action_dispatch/middleware/templates/routes/_route.html.erb (5.0ms)
Rendered C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.1.8
/lib/action_dispatch/middleware/templates/routes/_table.html.erb (2.5ms)
Rendered C:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/actionpack-4.1.8
/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb within
rescues/layout (125.0ms)

答案 0 :(得分:1)
您的错误不是来自您的删除方法。
我认为你没有这个文件 /stylesheets/defaults.css
-sorry我无法添加评论。