LoginSignup
18
9

More than 5 years have passed since last update.

Missing :controller key on routes definition, please check your routes.の対処法

Posted at

routes.rbを以下のようにした時にエラーが出ました。

routes.rb
Rails.application.routes.draw do
  root 'static_pages/home'
  get 'static_pages/help'
  get 'static_pages/about'
  get 'static_pages/contact'
end

Missing :controller key on routes definition, please check your routes.

これは、
root ‘static_pages/home’root ‘static_pages#home’に変更することによってエラーが解消されました。

stack overflowなどをのぞいていたら、rootは特別なケースだと記されていました。
rootを使用する際には、
root ‘static_pages#home’
この形にする必要があるようです。

18
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
18
9