Ruby 在 Rails 上抛出主页错误 - railties

Ruby On Rails throws error on home - railties

当我尝试我的页面时,即 localhost:3000/home - 它显示了这个错误。

这是控制台抛出的错误:

ActionController::RoutingError (No route matches [GET] "/home"):
  web-console (2.0.0.beta3) lib/action_dispatch/debug_exceptions.rb:22:in `middleware_call'
  web-console (2.0.0.beta3) lib/action_dispatch/debug_exceptions.rb:13:in `call'
  actionpack (4.2.2) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
  railties (4.2.2) lib/rails/rack/logger.rb:38:in `call_app'
  railties (4.2.2) lib/rails/rack/logger.rb:20:in `block in call'
  activesupport (4.2.2) lib/active_support/tagged_logging.rb:68:in `block in tagged'
  activesupport (4.2.2) lib/active_support/tagged_logging.rb:26:in `tagged'
  activesupport (4.2.2) lib/active_support/tagged_logging.rb:68:in `tagged'
  railties (4.2.2) lib/rails/rack/logger.rb:20:in `call'
  actionpack (4.2.2) lib/action_dispatch/middleware/request_id.rb:21:in `call'
  rack (1.6.4) lib/rack/methodoverride.rb:22:in `call'
  rack (1.6.4) lib/rack/runtime.rb:18:in `call'
  activesupport (4.2.2) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call' 

我认为 railties 有一些问题。但我不确定它是什么?

我的routes.rb内容:

Rails.application.routes.draw do
  get 'static_pages/home'
  get 'static_pages/help'
end

你应该这样定义你的路线:

get 'home' => 'static_pages#home'

或:

root 'static_pages#home'

如果你想让它成为你应用程序的根路径。