Is there any way to re-generate views from newly updated model?
Asked
Active
Viewed 4,797 times
3 Answers
14
Unless you've made a lot of changes to the scaffold, it's probably easier just to overwrite the current scaffold:
./script/generate -f scaffold Model

Benny Wong
- 6,773
- 5
- 31
- 25
-
1What is -f ? Couldn't find '-f' generator – totocaster Dec 02 '08 at 09:36
-
2-f, or --force, will overwrite files that already exists. You can run script/generate scaffold to see all available options. – Mike Breen Dec 02 '08 at 19:00
-
Thanks for the better answer. +1 – Kristian Dec 04 '12 at 06:22
-
8Should be `rails g scaffold Model -f` or `rails generate scaffold Model --force`. Anyway, thank you :) – Volker Rose Dec 11 '12 at 20:50
-
@totocaster 'Couldn't find '-f' generator' error is when you didn't put -f or --force option at the right place! Put it after model name. – Aboozar Rajabi Jul 08 '20 at 04:44
3
I had the same need, I just backed up some changes and did a destroy/generate, Take care, destroy deletes Everything related to the Model :
rails destroy scaffold Model -f
before I generate again.
rails generate scaffold Model

jbheren
- 516
- 3
- 11
1
The scaffold is not intended to create the interface, only to make a starting point for further development. I'm not sure it's even possible (without a lot of unnecessary work) to redo a scaffold, it's much quicker to manually edit the view and controller anyway.

Stein G. Strindhaug
- 5,077
- 2
- 28
- 41