views:

53

answers:

1

In my Rails application, I would like to route /product/productname1, /product/productname2, etc. to ProductController::index(). I don't want separate methods in my ProductController for each product name route.

What would my route look like?

I have

map.connect 'products/:name', :controller => 'products', :action => 'index'

But when I go to

/products/something

I get

No action responded to show. Actions: index
+1  A: 

Does it have to do with the ordering of your routes file? eg is this coming after map.resources :products?

Gordon Isnor
Ah ha! You, sir, are a gentleman and a scholar. Thanks! Moving map.resources :products below the map.connect line fixed the problem.
Chad Johnson