Apologies if this a trivially newb question but I'm new to rails (and
frameworks in general) but is there a way to change the model
definition using the scaffold, i.e. is it possible to update the
model, views etc if I decide I need to add field d to fields a, b and
c that I already created using script/generate scaffold...?
At the moment I'm having to delete the generated code, rollback the DB
migration ad generate it from scratch again - I'm sure there must be
an easier/faster way.
In most cases if you want to modify an existing schema you would
create a new migration file:
script/generate migration add_email_column_to_user
and then put what you need in the newly-created file and then run
If you're at the very beginning of a project, and decide you want to
change something, you might migrate backwards and start again. Once
the project is underway, though, migrating backwards ends up being
more confusing than it's worth in almost every case.
As for the scaffolding, I wouldn't recommend using it as the basis for
a real application, except in cases where what it produces is exactly
what you want. If you find yourself developing an app by starting with
the scaffolding and making lots of changes (or wondering whether what
you're doing is OK because it deviates from the scaffolding), it's a
sign that you should abandon the scaffolding and just develop the app.
Or you can skip that process and just abandon the scaffolding from the