Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/54.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 Rails路由器不';我看不到方法柱_Ruby On Rails - Fatal编程技术网

Ruby on rails Rails路由器不';我看不到方法柱

Ruby on rails Rails路由器不';我看不到方法柱,ruby-on-rails,Ruby On Rails,在routes.rb中,我有一行: resources :comments 但当我谈到/评论/创建时,我看到: No route matches [POST] "/comments/create" 怎么了?类和操作存在。查看rake routes输出中的第2行。 您应该发布到/comments,以启动创建操作 comments_path GET /comments(.:format) comments#index

在routes.rb中,我有一行:

resources :comments
但当我谈到/评论/创建时,我看到:

No route matches [POST] "/comments/create"


怎么了?类和操作存在。

查看
rake routes
输出中的第2行。 您应该发布到
/comments
,以启动
创建
操作

comments_path       GET     /comments(.:format)             comments#index
                    POST    /comments(.:format)             comments#create
new_comment_path    GET     /comments/new(.:format)         comments#new
edit_comment_path   GET     /comments/:id/edit(.:format)    comments#edit
comment_path        GET     /comments/:id(.:format)         comments#show
                    PATCH   /comments/:id(.:format)         comments#update
                    PUT     /comments/:id(.:format)         comments#update
                    DELETE  /comments/:id(.:format)         comments#destroy