LoginSignup
1
0

More than 3 years have passed since last update.

controller を間違えて生成してしまったら

Last updated at Posted at 2020-05-21

rails tutorial 3章 「ほぼ静的なページの作成」 にてcontrollerを生成する際にcontroller名を間違えて生成してしまいました。
その時の対処法です。


controller Static_Pages_controller.rb
アクション home help


controller Static_controller.rb
アクション Pages home help

原因

controllerを生成する際にコマンドラインで
rails g controller Static Pages home help
としてしまった為、Pages がアクションとして認識されてしまったんですね、、、

対処

rails destroy controller Static Pages home help
これで間違えて生成したcontrollerは削除できました。

再度
rails g controller StaticPages home help
で正しいcontrollerを生成

ちなみに
rails g controller Static_Pages home help
でも同じStatic_Pagesコントローラーが生成されます。

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