Q:

rails scaffold form, simplest way of adding a field?

Say I did rails g scaffold Review artist:string song:string genre:string and created a review object with those fields...would it later be possible to easily add another field like rating:int via a rails command, or would I need to manually edit all the files to include another data field for the form? I know it's possible to just delete the first scaffold and rebuild with the extra field, but I was just wondering if there was an easier way.
Thanks

A:

The scaffold just generates minimalist model, view and controller code along with (usually) a database migration.
If you haven't made any serious changes to any of that code, it may be easier to rerun the scaffold generator. If you haven't run the database migrations, or you haven't committed them, you can add your attributes in the existing migration code and follow up with corresponding changes in the view.
If you've committed the code and someone is already depending on the existing model, you'll want to generate a database change migration to preserve a graceful upgrade/downgrade path.
The scaffold isn't magic, it's just a quick and dirty way of generating code that you can edit.

