doemsche
doemsche

Reputation: 922

scaffold does not update view

I have a question to the following procedure:

My question is: why is the field description not added to the project-views? Is that normal rails scaffold behaviour? I think I saw in a video tutorial that the scaffold updates as well the views, which would be very convenient. Thanks in advance for any help!

Upvotes: 2

Views: 1614

Answers (2)

Steve Weet
Steve Weet

Reputation: 28392

This is normal behaviour for scaffolding, however there are alternatives.

If you were to look at Ryan Bates nifty_scaffold generator then this would allow you to re-run the scaffold generation. Assuming that you hadn't changed the generated code.

These generators can regenerate the views/spec/tests based upon the current state of the database model.

Be aware that if you have already customised the views yourself then they could be overwritten.

Upvotes: 2

Eimantas
Eimantas

Reputation: 49354

This is normal since scaffold does not "monitor" changes to the table or to any other scaffold-related resource (controller, model, views, tests, etc.).

then I generate a migration which adds a column description to the table products

You have description column already when generating the scaffold. Why do you need another migration for this?

Upvotes: 3

Related Questions