Topic: controller behaviour

Hi all,

I have a site eg . When a user goes to eg it should show all product info of the product 'car'. 'car' is thus the id of the controller/table product. Default Rails would handle this like but I want to get rid of the /product/ because it always involvs the product.

Can this be done with Rails?


Re: controller behaviour

Try adding this line to the routes.rb file:

map.connect ':action/:id', :controller => 'product'

Or if you want only the :id to be specified:

map.connect ':id', :controller => 'product', :action => 'show'

Railscasts - Free Ruby on Rails Screencasts