Scaffold - more than 1 model tied to a controller?

When I use the scaffold generator, I only have the option of tying one
model to one controller. If I have multiple models, how do I get all
the models to have scaffolding generated for the one controller?

Would the following work:

script/generate scaffold Model1 Controller
script/generate scaffold Model2 Controller
script/generate scaffold Model3 Controller

or would the following be better:
script/generate model Model1
script/generate model Model2
script/generate model Model3
script/generate scaffold Model1 Controller # which model to use?

and what happens if I create more models that I need to have scaffolding
built for my current controller? How would I integrate this new model
into the controller with scaffolding? Would this be one of those
instances where I need to do it by hand? Or am I missing something?

Thanks

Matt

as you get better at rails and ruby you will find yourself using the
scaffold less and coding the implementation from scratch because of the
various nuances between the apps you code.

You can have one controller for multiple models, you just cant scaffold
it. You will have to make them from scratch.

Try

script/generate controller Main index add_model1 edit_model1 view_model1
add_model2 edit_model2 view_model2 add_model3 edit_model3 view_model3

This will create controller with 9 stub views and methods for the
controller.

Then create your models
script/generate model Model1
script/generate model Model2
script/generate model Model3

Then you can edit the controller to add the CRUD logic for each model.

peace

–jake

matt wrote:

When I use the scaffold generator, I only have the option of tying one
model to one controller. If I have multiple models, how do I get all
the models to have scaffolding generated for the one controller?

Would the following work:

script/generate scaffold Model1 Controller
script/generate scaffold Model2 Controller
script/generate scaffold Model3 Controller

or would the following be better:
script/generate model Model1
script/generate model Model2
script/generate model Model3
script/generate scaffold Model1 Controller # which model to use?

and what happens if I create more models that I need to have scaffolding
built for my current controller? How would I integrate this new model
into the controller with scaffolding? Would this be one of those
instances where I need to do it by hand? Or am I missing something?

Thanks

Matt