LoginSignup
1
0

More than 1 year has passed since last update.

Railsでアプリを再作成した時のファイルを確認できない

Posted at

事象

rails g modelを実行すると、以下のエラーが発生。

❯ rails g model Post title:string content:text
Running via Spring preloader in process 16060
      invoke  active_record
The name 'Post' is either already used in your application or reserved by Ruby on Rails. Please choose an alternative or use --skip-collision-check or --force to skip this check and run this generator again.

既にPostモデルが作成されているというエラー。
ただし、vscodeやfinderで確認しても、Postモデルを確認できない。

解決方法

一度railsでアプリを作成して、削除後(ゴミ箱)に移動後、railsアプリを再作成していた。
今回のモデル作成では、ゴミ箱のディレクトリに作成されたままだった。
そのため、 ゴミ箱で対象アプリを削除した後、再度rails g modelを実行すると、成功した。
ゴミ箱のアプリの削除が必要だとは思わなかったので、今後気をつけたい。

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