I am creating an application with Ruby on rails, and when I did rails g model hoge (model name)
, I could not make a model for some reason, so I will write the cause and solution.
The result is as follows.
The name Diary
means that it cannot be used because it is already in use.
Since the application name was diary, I thought that I should change it, so I changed the folder name.
After making the change, I did rails g model diary
again ...
I got the exact same error: sweat:
You need to change the application name in the config
file.
before
app/config/application.rb
module Diary ← The application name is displayed here
class Application < Rails::Application
config.load_defaults 6.0
end
end
after
app/config/application.rb
module EveryDiary ← Change
class Application < Rails::Application
config.load_defaults 6.0
end
end
By changing the name, I was able to create a model safely! I felt that I also needed to check the config file.
Recommended Posts