views:

52

answers:

1

I have several static pages and a couple of dynamic pages. Static pages are under the "Info" controller. Dynamic pages are under "products". I want to access "products" from their :permalink I can only get map.info or map.products to work but not both.

 ActionController::Routing::Routes.draw do |map|
  map.resources :products
  map.resources :info
  map.root :controller => "products"
  map.info ':action', :controller => "info"
  map.products ':permalink', :controller => 'products', :action => 'show'
  map.connect ':controller/:action/:id'
  map.connect ':controller/:action/:id.:format'
 end
+1  A: 

Let's say you go to http://yoursite.com/something

How can the routes determine if it's a product or info page? It can't, and that's why it won't work. You have to put one of them under a namespace of some sort.

map.info ':action', :controller => "info"
map.products '/products/:permalink', :controller => 'products', :action => 'show'
jshen
OK, close. Is it possible to have map.info '/info/:action' and then map.products ':permalink'? when I try this I get "No action responded to show. Actions:"
pcasa
What url are you using?
jshen