SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
Thread: Rails: regarding controllers
-
Feb 23, 2006, 21:15 #1
- Join Date
- Mar 2004
- Location
- Toronto, Canada
- Posts
- 326
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Rails: regarding controllers
Assume I have a controller called admin in app/controllers as well as three model classes in app/models: product, category, warehouse.
How exactly do I use the admin controller to produce this kind of structure:
Code:http://localhost:3000/admin/product/ #lists products http://localhost:3000/admin/product/edit/1 http://localhost:3000/admin/category/new http://localhost:3000/admin/warehouse/show/16
Code:http://localhost:3000/admin/edit/1 http://localhost:3000/admin/list http://localhost:3000/admin/show/16
Hope my explanation makes sense. Any help appreciated.
-
Feb 24, 2006, 04:38 #2
Originally Posted by gregor002
If you start seeing yourself with controller methods like create_xxx, edit_xxx, create_yyy, edit_yyy for example, its a sign you really need an XXX and YYY controlller.
You can put controllers in modules, which will be located in app/controllers/modulename/ - in this case, an admin module.
Code:> ./script/generate controller admin/products
Access it at http://myapp/admin/products
-
Feb 24, 2006, 10:40 #3
- Join Date
- Mar 2004
- Location
- Toronto, Canada
- Posts
- 326
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Thanks for that Luke. I've realized that modules are the route that I want to take.
Bookmarks