[英]Rails router doesn't see method post
in routes.rb i have line: 在routes.rb我有线:
resources :comments
but when i come to /comments/create i see: 但当我来/评论/创建我看到:
No route matches [POST] "/comments/create"
... ...
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
What is wrong? 怎么了? Class and action are exists.
类和动作是存在的。
Look at line 2 in your rake routes
output. 查看
rake routes
输出中的第2行。 You should POST to /comments
in order to fire create
action. 您应该POST
/comments
以触发create
操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.