How to undo a rails generate command?

How it’s done

You’ve accidentally stuffed something up. You can easily undo it like this:

rails destroy model name_of_model
rails destroy controller name_of_controller
rails destroy scaffold name_of_scaffold

You’d obviously substitute the names of your own objects with the dummy names given above :)

You can also substitute the letter ‘d’ for the the word ‘destroy’ and rails will still understand the command.

Hope this helps!

Written on December 30, 2016