Soldato
- Joined
- 26 Nov 2003
- Posts
- 6,674
- Location
- East Sussex
Evening folks, hoping someone can help me with this.
I am trying to learn rails and want to tidy up my folders/files a bit, and make a deeper URL structure to the example app I'm building.
Firstly I'm trying to make an admin page for adding products to a catalogue.
The catalogue can be browsed at http://x/store
I would like the products to be admin'd at http://x/admin/products
The files responsible for this are:
app/controllers/store_controller
app/controllers/admin/product_controller
using:
app/model/products
with views:
app/views/store/*
app/views/admin/products/*
In the product_controller I have the following
"class Admin:
roductsController < ApplicationController"
I tried having the products mapped to an admin namespace, but I think what I'm trying to do is quite simple (I hope!) and therefore I wondered if that method (map.resources to namespace admin.products, call actions with [:admin,
bject]) was not perhaps overkill?
On my local webbrick server this works as I hoped. I can navigate to the addresses above without incident and everything works, just by having the products controller declared as admin:
roducts.
Products can be added, actions linked to, its fine.
But when I deployed this on my webserver the result of navigating to admin/products/ is:
"Unknown action
No action responded to products. Actions: index"
So, am I simply wrong? Is using a namespace the only way to add a deeper structure to urls?
Does anyone know why this works locally but not online?
Only difference I can see is local ruby = 1.8.6, online ruby = 1.8.7.
I'd greatly appreciate any input on this issue. Even if it's a simple "yep, just use namespaces and quit whining ffs!"
Thanks!
I am trying to learn rails and want to tidy up my folders/files a bit, and make a deeper URL structure to the example app I'm building.
Firstly I'm trying to make an admin page for adding products to a catalogue.
The catalogue can be browsed at http://x/store
I would like the products to be admin'd at http://x/admin/products
The files responsible for this are:
app/controllers/store_controller
app/controllers/admin/product_controller
using:
app/model/products
with views:
app/views/store/*
app/views/admin/products/*
In the product_controller I have the following
"class Admin:

I tried having the products mapped to an admin namespace, but I think what I'm trying to do is quite simple (I hope!) and therefore I wondered if that method (map.resources to namespace admin.products, call actions with [:admin,

On my local webbrick server this works as I hoped. I can navigate to the addresses above without incident and everything works, just by having the products controller declared as admin:

Products can be added, actions linked to, its fine.
But when I deployed this on my webserver the result of navigating to admin/products/ is:
"Unknown action
No action responded to products. Actions: index"
So, am I simply wrong? Is using a namespace the only way to add a deeper structure to urls?
Does anyone know why this works locally but not online?
Only difference I can see is local ruby = 1.8.6, online ruby = 1.8.7.
I'd greatly appreciate any input on this issue. Even if it's a simple "yep, just use namespaces and quit whining ffs!"

Thanks!