This can happen if you are working with a model that is not supported by the database, then you decide that you want it to be, and expand ActiveRecord::Base and realize that there is no table. I would go into the Rails console and look at the methods in the class. You can print the setup methods as follows:
>> y Model.instance_methods(false).grep /\=/ # "Model" is the name of your class
Then I create a new migration, as usual, and define the columns with their types. for example, if your model has a column of type string name names, rails g migration Model name:string . You might want to delete some of the generated files. If it does not work because it matches the name, I would check if there is a force parameter, or I would temporarily rename my existing model class and then call it back after creating the migration.
source share