0
0

More than 1 year has passed since last update.

【Rails】Unable to autoload constant (module名)::(controller名)Controllerエラーが出た件

Last updated at Posted at 2022-01-30

状況

  • routing、model、controller、viewを作成し、ローカルでページにアクセスしてみた。
  • 以下のエラーが表示された。
Unable to autoload constant (module名)::(controller名)Controller, expected 
/(service名)/app/controllers/(controller名)_controller.rb to define it

解決法

コントローラーの内容を module ~ end で囲う。

(controller名)_controller.rb
module (module)
  class (controller)Controller < ApplicationController
    (コントローラーの内容)
  end
end

このような見落としを防ぎたい限りである。

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