Undo scaffolding in Rails Undo scaffolding in Rails ruby-on-rails ruby-on-rails

Undo scaffolding in Rails


First, if you have already run the migrations generated by the scaffold command, you have to perform a rollback first.

rake db:rollback

You can create scaffolding using:

rails generate scaffold MyFoo 

(or similar), and you can destroy/undo it using

rails destroy scaffold MyFoo

That will delete all the files created by generate, but not any additional changes you may have made manually.


Rishav Rastogi is right, and with rails 3.0 or higher its:

rails generate scaffold ...
rails destroy scaffold ...


You can undo whatever you did with

rails generate xxx

By

rails destroy xxx

For example this applies generators to migration, scaffold, model...etc