Ruby on rails 没有与[GET]匹配的路由/索引“;RubyonRails错误
我是Rails新手,我在routes.rb中获得了此代码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.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,这是一个很棒的社区!