0

this question may sound silly but i wanted to know if there way a way to update the form and model once we change a database.

For example when i generate scaffolding i may forget 2 fields that i need to put in the db and when i remember them later i generate a migration but then i have to go in and change the form and the attr_accessible in the db etc.

Is there a shortcut available to this? If i make changes to a db table - is there a command available to update my model and form elements with those changes?

I just wanted to know if there is a shortcut available to achieve these - saves a lot of work as models evolve and changes are made to the db.

Thanks

deepinder
  • 131
  • 2
  • 8

1 Answers1

0

If you haven't changed the files from the original scaffolding, then why not just re-scaffold them?

If you have changed the files, then no there's no shortcut.

Then again, scaffolding is exactly that - it's not meant to be the finished product. It's inadvisable to use it in anything other than working out the correct model relationships and getting a feel for the app. After that you should manually refine the code and remove any controller/view functionality that you don't want to give to users.

Jon Cairns
  • 11,783
  • 4
  • 39
  • 66