Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/61.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 没有与[GET]匹配的路由/索引“;RubyonRails错误_Ruby On Rails - Fatal编程技术网

Ruby on rails 没有与[GET]匹配的路由/索引“;RubyonRails错误

Ruby on rails 没有与[GET]匹配的路由/索引“;RubyonRails错误,ruby-on-rails,Ruby On Rails,我是Rails新手,我在routes.rb中获得了此代码 Rails.application.routes.draw do get 'welcome/index' => 'welcome#index' # The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay out with "rake routes".

我是Rails新手,我在routes.rb中获得了此代码

Rails.application.routes.draw do
  get 'welcome/index' => 'welcome#index'
  # The priority is based upon order of creation: first created -> highest priority.
  # See how all your routes lay out with "rake routes".

  # You can have the root of your site routed with "root"
  root 'welcome#index'
但是在localhost:3000/index中,它显示了这个错误

No route matches [GET] "/index"
有什么问题吗

get 'welcome/index' => 'welcome#index'
这段代码将为localhost:3000/welcome/index生成一个路由

get 'index' => 'welcome#index' 
将生成您想要的路线。有关更多详细信息,请参阅文档

这段代码将为localhost:3000/welcome/index生成一个路由

get 'index' => 'welcome#index' 

将生成您想要的路线。有关更多详细信息,请参阅文档

谢谢,它起作用了!我会在9分钟内接受你的回答:)很高兴我能帮忙!希望到目前为止您喜欢rails和ruby,这是一个很棒的社区!谢谢,成功了!我会在9分钟内接受你的回答:)很高兴我能帮忙!希望到目前为止您喜欢rails和ruby,这是一个很棒的社区!