I''d like to create scaffolds for each of the tables in my database, but would like to access them below the path: localhost:3000/admin For example localhost:3000/admin/table1 localhost:3000/admin/table2 Where table1 and table2 would be the controller names respectively, calling their own list.rhtml, show.rhtml, edit.rhtml, etc.. Any recommendations on how/where to utilize multiple scaffolds? Thanks! -- Posted via http://www.ruby-forum.com/.
You can create scaffolds in seperate modules by doing this: ruby script/generate scaffold Admin::Model1 ruby script/generate scaffold Admin::Model2 The controllers will then be accessible via: /admin/model1/ (list/edit/show etc) /admin/model2/ (list/edit/show etc) Hope that helps, Steve ryan wrote:> I''d like to create scaffolds for each of the tables in my database, but > would like to access them below the path: localhost:3000/admin > > For example localhost:3000/admin/table1 > localhost:3000/admin/table2 > > > Where table1 and table2 would be the controller names respectively, > calling their own list.rhtml, show.rhtml, edit.rhtml, etc.. > > Any recommendations on how/where to utilize multiple scaffolds? > > Thanks! >
Stephen, That did work indeed. Thanks! However, I had to make sure I didn''t already have an admin_controller.rb at the root. The admin_controller.rb in the /admin directory of /admin/model1 was attempting to call an action "model1". Maybe there''s a way to make the controller ignore that and execute the /admin/model1_controller.rb instead. But for now, I deleted the admin_controller.rb on the root. -- Posted via http://www.ruby-forum.com/.
On 5/3/06, ryan <ibwold@hotmail.com> wrote:> Stephen, > > That did work indeed. Thanks! > > However, I had to make sure I didn''t already have an admin_controller.rb > at the root. > > The admin_controller.rb in the /admin directory of /admin/model1 was > attempting to call an action "model1". Maybe there''s a way to make the > controller ignore that and execute the /admin/model1_controller.rb > instead. > > But for now, I deleted the admin_controller.rb on the root.You could always keep the admin_controller.rb in app/controllers and do the following in your AdminController: scaffold :model1, :suffix=>true scaffold :model2, :suffix=>true Then you can access the scaffolds at /admin/list_model1 and admin/list_model2. Also, you may want to check out the Scaffolding Extensions Plugin[1], which greatly enhances the default scaffolding. Jeremy [1] http://wiki.rubyonrails.com/rails/pages/Scaffolding+Extensions+Plugin
ryan wrote:> The admin_controller.rb in the /admin directory of /admin/model1 was > attempting to call an action "model1". Maybe there''s a way to make the > controller ignore that and execute the /admin/model1_controller.rb > instead.Is there anyway to use static scaffolds, have an admin_controller and have the model1_controller and model2_controllers in the /admin/ directory? I would like to be able to have admin go to railsapp/admin and then be able to click links to go to the actions to crud model1 and model2 but still have static scaffolds to work with. Best, Sam -- 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 -~----------~----~----~----~------~----~------~--~---
See this post: http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/c835bd6eca8598c2/298b8b0b2cdccac4?lnk=gst&q=controller+subdirectory&rnum=3&hl=en#298b8b0b2cdccac4 On Mar 15, 3:00 am, Sam Woodard <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> ryan wrote: > > The admin_controller.rb in the /admin directory of /admin/model1 was > > attempting to call an action "model1". Maybe there''s a way to make the > > controller ignore that and execute the /admin/model1_controller.rb > > instead. > > Is there anyway to use static scaffolds, have an admin_controller and > have the model1_controller and model2_controllers in the /admin/ > directory? I would like to be able to have admin go to railsapp/admin > and then be able to click links to go to the actions to crud model1 and > model2 but still have static scaffolds to work with. > > Best, > Sam > > -- > Posted viahttp://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 -~----------~----~----~----~------~----~------~--~---