Removing a model from your rails project

During the work on a project I created a model. Right after clicking the Enter key I realized that I didn’t need it and wanted to roll back. Because I am using GIT, I could of course have done this using it, but I wanted to do it using a Rails command. Turns out, there’s a command to do this (if you haven’t migrated the db yet). The command is as follows:

script/destroy model contact

This will remove all of the files that were added by this command.

script/generate model contact user_id:integer type:integer

Nice to know you can either do this with GIT or with Rails. Obviously the best solution is to think before you click Enter :-) but it’s nice to know nevertheless.

<img src="" height="1" width="1"/>
Thank you for your interest!

We will contact you as soon as possible.

Send us a message

Oops, something went wrong
Please try again or contact us by email at