rollback generated controller/model in RoR

Itay Moav -Malimovka picture Itay Moav -Malimovka · Mar 12, 2011 · Viewed 22.4k times · Source

I created, using the scaffolding, a model and controller files.
Later I discovered it would be a good idea to create the tables in the DB first...
My question, How can I role back the generated files and regenerate them now, that I have the tables in the DB?

I just started learning RoR, so right now I am not interested in best practices, just learning the tool box this FW (RoR) comes with.

And, do you have a recommendation for a good tutorial? I do know to use google, it is just that search engines don't know, yet (working on that), how to grade tutorials.
Edit: For my last question I found Learning Ruby on Rails

Answer

stephenmurdoch picture stephenmurdoch · Mar 12, 2011

try

rails destroy scaffold XXXXX

one thing that I find puzzling though is that you said "Later I discovered it would be a good idea to create the tables in the DB first..."

Well, rails creates a migration file for you when you run the generator in the first place, and this file will create your DB tables and fields when you run it using rake db:migrate

PS - here's a few good tutorials for you: