Search code examples
ruby-on-railsmigrationrefactoring

Rails remove old models with migrations


I have a bunch of rails models that I'm re-writing into a single model to simplify my code and reduce unnecessary tables.

I'm wondering what the best way to delete a model class and its table is. I want past migrations to still succeed, but I don't want to leave the empty models lying around.

Do I have to manually delete the old migrations that reference these models, then manually delete the class files?

Does anyone have any tips for the best way to do this?


Solution

  • What about doing ruby script/destroy model? That should take care of the model and the migration.