2010-02-12 3 views
0

몇 개의 정적 페이지와 몇 개의 동적 페이지가 있습니다. 정적 페이지는 "정보"컨트롤러 아래에 있습니다. 동적 페이지는 "제품"아래에 있습니다. 나는 그들로부터 "제품"에 접근하고 싶다 : permalink 나는 map.info 나 map.products를 작동 시키지만 둘 다 할 수는 없다.Ruby 이름 퍼머 링크 및 정적 페이지가있는 경로

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

의 당신이 루트가 제품이나 정보 페이지에 있는지 확인하는 방법을 http://yoursite.com/something

로 이동한다고 가정 해 봅시다? 그렇게 할 수 없기 때문에 그것이 작동하지 않습니다. 그 중 하나를 네임 스페이스 아래에 두어야합니다.

map.info ':action', :controller => "info" 
map.products '/products/:permalink', :controller => 'products', :action => 'show' 
+0

확인, 종료. map.info '/ info/: action'을 사용하고 map.products ': permalink'를 사용할 수 있습니까? 이 작업을 시도 할 때 "표시 할 작업이 없습니다."작업 : " – pcasa

+0

어떤 URL을 사용하고 있습니까? – jshen

관련 문제