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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jake Varghese
2006-Dec-16 17:08 UTC
Re: scaffold - more than 1 model tied to a controller ?
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-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---