0
0

More than 1 year has passed since last update.

controller作成がうまくできないとき

Posted at

開発環境

ruby 3.1.2 Rails 6.1.7です。

概要

投稿アプリを作るときにusersコントローラーを作ろうとしたが作れなかった。

その時のエラー

`const_get': uninitialized constant Users 

    Object.const_get(camel_cased_word)
          ^^^^^^^^^^ (NameError)

rails g controller users index show editを実行したときに出てきて解決できなかった。

解決方法

様々な記事を見ていると、「devise_for :usersのせいでルーティングがおかしくなっている」という記事を見つけた。試しに、自分のroute.rbからdevise_for :usersをコメントアウトしたら解決した。

参照 https://qiita.com/blackpeach7/items/dd71417bf0b0ef937369

0
0
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
0
0