I'm using Rails 3.2, and have started with a scaffolding and built out from it, but have realized I need to rename the entire scaffold (Model, View, Controller, db:migrate
, etc). Is there a built in way to do this, or should I just do it manually?
I don't think there's anything rails
provides to rename the name of models/controllers/views/tests
etc. once they are created - whether as a part of a scaffold, or not.
You will have to change it manually.
If it is a brand new app that you have just started on, it might be easier to just delete the whole directory/drop the database, and start over again.
If not, you will have to go through the files created/modified by the scaffold generation, and modify them manually.
Make sure you either drop_and_recreate the relevant table, or add a migration to rename the table. See How do you write a migration to rename an ActiveRecord model and its table in Rails? for some relevant advice.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With