Question

script/generate scaffold Album

used to generate the scaffolding for a model called Album (pre-Rails 2).

Is it correct that these days (post-Rails 2), you need to specify all of the required fields:

script/generate scaffold Album artist:String title:String

I've been following along with a tutorial on Rails 1.1.6 and have been puzzled about why

script/generate scaffold Album

doesn't work the way the tutorial describes but my suspicion is that the new format of the command requires that you explicitly spell out all of the fields that you want in the scaffold.

It's disappointing if Rails has lost the ability to concisely generate scaffold based on the model name alone since it "knows" through schema.db what all of the fields for the model are without you explicitly declaring them to the scaffold command.

Was it helpful?

Solution

If you don't specify the fields in the command then Rails won't build any of the scaffolding with the fields information pre-populated, like in the views.

script/generate scaffold Album

should still be valid, but you'll have to go make all the form and display views as well as define all the fields in the migration file.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top