在阅读 Michael Hartl 的教程时,我遇到了这个错误。第 5.3.2 节(铁路路线)。
我的routes.rb文件的内容是
SampleApp::Application.routes.draw do
root 'static_pages#home'
match '/help', to: 'static_pages#help', via: 'get'
match '/about', to: 'static_pages#about', via: 'get'
match '/contact', to: 'static_pages#contact', via: 'get'
end
我在 static_pages的rspec是成功的 ..我已按照所有说明进行操作,但在尝试访问 ` 处的任何页面时仍然出现此错误
http://localhost:3000/static_pages/home
http://localhost:3000/static_pages/about
http://localhost:3000/static_pages/contact
这是我在这些页面上遇到的错误
动作控制器:捕捉到异常
Routing Error
No route matches [GET] "/static_pages/about"
Rails.root: /home/abhinay/rails_projects/sample_app
Application Trace | Framework Trace | Full Trace
Routes
Routes match in priority from top to bottom
Helper HTTP Verb Path Controller#Action
Path / Url
root_path GET / static_pages#home
help_path GET /help(.:format) static_pages#help
about_path GET /about(.:format) static_pages#about
contact_path GET /contact(.:format) static_pages#contact