Yannick Koehler
2005-Sep-23 12:19 UTC
Re: Adding Categories to the Depot example in the Agile Railsbook
Hi Andrew, Yes, there is a way. You type the following: ruby scripts/generate scaffold admin::product So in my example you would do: ruby scripts/generate controller general_admin ruby scripts/generate scaffold admin::product ruby scripts/generate scaffold admin::category Then you would change route.rb to do something like map.admin ''admin'', :controller => ''admin/general'', :action => ''index'' Finally, I would recommend to edit all the controller to depend on GeneralAdminController instead of ApplicationController so that they inherit the layout from general_admin and you can also populate general_admin with other member function that are specific to the admin section of your site. -- Yannick Koehler
Kris Leech
2005-Sep-23 14:28 UTC
Re: Re: Adding Categories to the Depot example in the Agile Railsbook
Is ruby scripts/generate scaffold admin::product the same as ruby scripts/generate scaffold admin/product Thanks for the suggestions I''m just trying to get my head round it :) Yannick Koehler wrote:>Hi Andrew, > > Yes, there is a way. You type the following: > >ruby scripts/generate scaffold admin::product > > So in my example you would do: > >ruby scripts/generate controller general_admin >ruby scripts/generate scaffold admin::product >ruby scripts/generate scaffold admin::category > >Then you would change route.rb to do something like > >map.admin ''admin'', :controller => ''admin/general'', :action => ''index'' > >Finally, I would recommend to edit all the controller to depend on >GeneralAdminController instead of ApplicationController so that they >inherit the layout from general_admin and you can also populate >general_admin with other member function that are specific to the >admin section of your site. > >-- >Yannick Koehler >_______________________________________________ >Rails mailing list >Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >http://lists.rubyonrails.org/mailman/listinfo/rails > > > >-- Interkonect Services UK Ltd. Boundary House Main Street Hoveringham Nottingham NG147 JR web: www.interkonect.com tel: 0115 9663696 fax: 0115 9663696
Yannick Koehler
2005-Sep-23 14:38 UTC
Re: Re: Adding Categories to the Depot example in the Agile Railsbook
Hi Kris, I think not, at least not from the Agile Web Development book. You should see that the difference lies in the class name. Using admin::product will create a controller called Admin::ProductController, while using admin/product will create a controller ProductController but in the folder Admin. -- Yannick Koehler 2005/9/23, Kris Leech <krisleech-BSIDdvZawMx9qp0gCGiW7Q@public.gmane.org>:> Is > > ruby scripts/generate scaffold admin::product > > the same as > > ruby scripts/generate scaffold admin/product > > > Thanks for the suggestions I''m just trying to get my head round it :) > > > Yannick Koehler wrote: > > >Hi Andrew, > > > > Yes, there is a way. You type the following: > > > >ruby scripts/generate scaffold admin::product > > > > So in my example you would do: > > > >ruby scripts/generate controller general_admin > >ruby scripts/generate scaffold admin::product > >ruby scripts/generate scaffold admin::category > > > >Then you would change route.rb to do something like > > > >map.admin ''admin'', :controller => ''admin/general'', :action => ''index'' > > > >Finally, I would recommend to edit all the controller to depend on > >GeneralAdminController instead of ApplicationController so that they > >inherit the layout from general_admin and you can also populate > >general_admin with other member function that are specific to the > >admin section of your site. > > > >-- > >Yannick Koehler > >_______________________________________________ > >Rails mailing list > >Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > >http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > > -- > Interkonect Services UK Ltd. > Boundary House > Main Street > Hoveringham > Nottingham > NG147 JR > > web: www.interkonect.com > tel: 0115 9663696 > fax: 0115 9663696 > >
Liquid
2005-Sep-25 06:07 UTC
Re: Re: Adding Categories to the Depot example in the Agile Railsbook
Hi Yannick, Just wondering what the benefit of having an Admin::ProductController is over a ProductController in the Admin folder? Also, what would the URL look like for Admin::ProductController? Cheers Dan Neighman On 9/24/05, Yannick Koehler <ykoehler-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hi Kris, > > I think not, at least not from the Agile Web Development book. You > should see that the difference lies in the class name. Using > admin::product will create a controller called > Admin::ProductController, while using admin/product will create a > controller ProductController but in the folder Admin. > > -- > Yannick Koehler > > 2005/9/23, Kris Leech <krisleech-BSIDdvZawMx9qp0gCGiW7Q@public.gmane.org>: > > Is > > > > ruby scripts/generate scaffold admin::product > > > > the same as > > > > ruby scripts/generate scaffold admin/product > > > > > > Thanks for the suggestions I''m just trying to get my head round it :) > > > > > > Yannick Koehler wrote: > > > > >Hi Andrew, > > > > > > Yes, there is a way. You type the following: > > > > > >ruby scripts/generate scaffold admin::product > > > > > > So in my example you would do: > > > > > >ruby scripts/generate controller general_admin > > >ruby scripts/generate scaffold admin::product > > >ruby scripts/generate scaffold admin::category > > > > > >Then you would change route.rb to do something like > > > > > >map.admin ''admin'', :controller => ''admin/general'', :action => ''index'' > > > > > >Finally, I would recommend to edit all the controller to depend on > > >GeneralAdminController instead of ApplicationController so that they > > >inherit the layout from general_admin and you can also populate > > >general_admin with other member function that are specific to the > > >admin section of your site. > > > > > >-- > > >Yannick Koehler > > >_______________________________________________ > > >Rails mailing list > > >Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > >http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > > > > > > > > > -- > > Interkonect Services UK Ltd. > > Boundary House > > Main Street > > Hoveringham > > Nottingham > > NG147 JR > > > > web: www.interkonect.com <http://www.interkonect.com> > > tel: 0115 9663696 > > fax: 0115 9663696 > > > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Yannick Koehler
2005-Sep-25 16:52 UTC
Re: Re: Adding Categories to the Depot example in the Agile Railsbook
Hi Liquid, I think that you if you have a ProductController (independentely of where you put it), then the controller will be call for the following URLs: /product/ /admin/product/ /anything/product/ While if you have a controller named Admin::ProductController, then the controller will be call for the following URLs: /admin/product/ /anything/admin/product/ Making the admin/ part mandatory as a prefix to the controller name. -- Yannick Koehler 2005/9/25, Liquid <has.sox-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> Hi Yannick, > > Just wondering what the benefit of having an Admin::ProductController is > over a ProductController in the Admin folder? Also, what would the URL look > like for Admin::ProductController? > > Cheers > Dan Neighman > > > On 9/24/05, Yannick Koehler <ykoehler-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Hi Kris, > > > > I think not, at least not from the Agile Web Development book. You > > should see that the difference lies in the class name. Using > > admin::product will create a controller called > > Admin::ProductController, while using admin/product will create a > > controller ProductController but in the folder Admin. > > > > -- > > Yannick Koehler > > > > 2005/9/23, Kris Leech <krisleech-BSIDdvZawMx9qp0gCGiW7Q@public.gmane.org>: > > > Is > > > > > > ruby scripts/generate scaffold admin::product > > > > > > the same as > > > > > > ruby scripts/generate scaffold admin/product > > > > > > > > > Thanks for the suggestions I''m just trying to get my head round it :) > > > > > > > > > Yannick Koehler wrote: > > > > > > >Hi Andrew, > > > > > > > > Yes, there is a way. You type the following: > > > > > > > >ruby scripts/generate scaffold admin::product > > > > > > > > So in my example you would do: > > > > > > > >ruby scripts/generate controller general_admin > > > >ruby scripts/generate scaffold admin::product > > > >ruby scripts/generate scaffold admin::category > > > > > > > >Then you would change route.rb to do something like > > > > > > > >map.admin ''admin'', :controller => ''admin/general'', :action => ''index'' > > > > > > > >Finally, I would recommend to edit all the controller to depend on > > > >GeneralAdminController instead of ApplicationController so that they > > > >inherit the layout from general_admin and you can also populate > > > >general_admin with other member function that are specific to the > > > >admin section of your site. > > > > > > > >-- > > > >Yannick Koehler > > > >_______________________________________________ > > > >Rails mailing list > > > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > >http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > Interkonect Services UK Ltd. > > > Boundary House > > > Main Street > > > Hoveringham > > > Nottingham > > > NG147 JR > > > > > > web: www.interkonect.com > > > tel: 0115 9663696 > > > fax: 0115 9663696 > > > > > > > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > >