Last Updated: February 25, 2016
·
2.21K
· sameera207

Reverse a scaffold in rails

When we need quick prototyping we still uses scaffolding. (At least I do...), But sometimes we want to revert the scaffold which we generated..

Since scaffolding creates number of files in the project, its a pain in the a&* to remove them manually. So for that rails is providing a method
called

destroy  

As per the documentation

destroy      Undo code generated with "generate" (short-cut alias: "d")

So in a nutshell,

If you created a scaffold

rails g scaffold Company

you can revert it by executing

rails d scaffold Company name:string