After changing the name of a field in a table, how do I update the entire Rails project?

1

I used Scaffold to generate a small project, then I changed the name of a field in a table, (something that is rare but happens in real life), how to update the entire project? P.S .: The rake db: migrate has already been done without error and the table already has the field name changed.

    
asked by anonymous 07.12.2014 / 14:05

1 answer

1

What do you mean by "updating the whole project"? Generate the Scaffold back to him?

rails g scaffold <model>

You will have to overwrite the files already generated.

If you have made important changes to the generated files, I strongly advise you to do the manual editing (add the field to the views, controllers, etc.).

Do not forget that if you did not use migration to create this change, only changing the migration master file does not reflect in db: migrate. In this case, you would have to drop the database (db: drop), create it again (db: create) and then migrate (db: migrate). Just be careful with these steps because it will erase everything you already have, so for migrations always use the command:

rails g migration <acao>

Related links:

  • migrations
  • 07.12.2014 / 20:02