[英]Routing error in ruby rails
So, I am trying to send a GET request from Postman and trying to run the method called question. 因此,我试图从邮递员发送GET请求,并尝试运行称为问题的方法。 I am also passing parameters in my request.
我也在请求中传递参数。 I keep getting a routing error.
我不断收到路由错误。 Im not sure why.
我不确定为什么。 The way I am trying to route it is given below
我尝试路由的方式如下
Rails.application.routes.draw do
namespace 'api' do
namespace 'v1' do
get 'questions', to: 'application#/api/v1/question'
end
end
end
My questions_controller.rb has a method called question. 我的questions_controller.rb有一个称为问题的方法。 The file is in app/controllers/api/v1/questions_controller.rb
该文件位于app / controllers / api / v1 / questions_controller.rb中
The error I am getting, Picture of the error I am getting 我收到的错误,我收到的错误图片
have you tried this? 你尝试过这个吗?
Rails.application.routes.draw do
namespace 'api' do
namespace 'v1' do
get 'questions', to: 'questions#question'
end
end
end
Since you already said your namespaces maybe it isn't necessary 既然您已经说过您的名称空间,则可能没有必要
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.