Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reverse a 'rails generate'

I want to delete all the files it created and roll back any changes made, but not necessarily to the database, but more to the config files.

I'd like to automatically delete all the resource mappings for the model/controller deleted in the routes.rb file and everywhere else that changes might have been made?

like image 413
marcamillion Avatar asked Nov 12 '10 03:11

marcamillion


People also ask

How do you revert scaffolding?

You can remove scaffold in the following way: Generate scaffold: $rails generate scaffold Story. If you migrated your files, perform a rollback: $rake db:rollback. Destroy or undo scaffold: $rails destroy scaffold Story.


1 Answers

rails destroy controller lalala rails destroy model yadayada rails destroy scaffold hohoho 

Rails 3.2 adds a new d shortcut to the command, so now you can write:

rails d controller lalala rails d model yadayada rails d scaffold hohoho 
like image 139
Fábio Batista Avatar answered Oct 09 '22 11:10

Fábio Batista