Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ruby-on-rails-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 3 Rails-没有路由匹配{:action=>;new";,:controller=>;comments";}_Ruby On Rails 3_Routes_New Operator - Fatal编程技术网

Ruby on rails 3 Rails-没有路由匹配{:action=>;new";,:controller=>;comments";}

Ruby on rails 3 Rails-没有路由匹配{:action=>;new";,:controller=>;comments";},ruby-on-rails-3,routes,new-operator,Ruby On Rails 3,Routes,New Operator,尝试了所有方法,但似乎找不到问题所在 本地主机上的错误:3000 No route matches {:action=>"new", :controller=>"comments"} 服务器错误 Rendered tasks/show.html.erb within layouts/application (134.7ms) Completed 500 Internal Server Error in 187ms ActionView::Template::Error (No r

尝试了所有方法,但似乎找不到问题所在

本地主机上的错误:3000

No route matches {:action=>"new", :controller=>"comments"}
服务器错误

Rendered tasks/show.html.erb within layouts/application (134.7ms)
Completed 500 Internal Server Error in 187ms

ActionView::Template::Error (No route matches {:action=>"new", :controller=>"comments"}):
    66: 
    67: <br />
    68: 
    69: <%= link_to 'New Comment', new_task_comment_path %>
    70: 
    71: 
    72: 
  app/views/tasks/show.html.erb:69:in `_app_views_tasks_show_html_erb___1205853643464254853_2489437560'
  app/controllers/tasks_controller.rb:18:in `show'
以及我的
$rake routes

$ rake routes
    task_comments GET    /tasks/:task_id/comments(.:format)          {:action=>"index", :controller=>"comments"}
                  POST   /tasks/:task_id/comments(.:format)          {:action=>"create", :controller=>"comments"}
 new_task_comment GET    /tasks/:task_id/comments/new(.:format)      {:action=>"new", :controller=>"comments"}
edit_task_comment GET    /tasks/:task_id/comments/:id/edit(.:format) {:action=>"edit", :controller=>"comments"}
     task_comment GET    /tasks/:task_id/comments/:id(.:format)      {:action=>"show", :controller=>"comments"}
                  PUT    /tasks/:task_id/comments/:id(.:format)      {:action=>"update", :controller=>"comments"}
                  DELETE /tasks/:task_id/comments/:id(.:format)      {:action=>"destroy", :controller=>"comments"}

我在这里遗漏了什么?

您没有向其传递
任务id

new_task_comment_path(@task.id)

一旦那个讨厌的计时器用完了,我就去
new_task_comment_path(@task.id)