2010-11-21 6 views
0

나는 나의 rails2.x 응용 프로그램에서이 경로를했다rails3 + 라우팅 문제

'이 web_page'라는 컨트롤러에 내 루트 후 '인덱스'

라는 행동에 모든 네임 스페이스를 지시

map.with_options(:controller => "web_page") do |site| 
    site.connect "*url", :action => "index" 
end 

예하십시오 I 유형이 http://localhost:3000/productshttp://localhost:3000/web_pages/index

에가는 경우 I 유형은 http://localhost:3000/services 아직도는 http://localhost:3000/web_pages/index

로 이동하는 경우

하지만 어떻게 rails3 경로에서이 작업을 수행 할 수 있습니다

pls는 사전에

덕분에 도움이

환호

사 미라

답변

0

당신은 사용할 수 있습니다

match '/:all' => 'web_page#index', :constraints => { :all => /.+/ } 

요청하다 http://example.com/this/is/a/test?option=true 되십시오 :

class WebPageController < ApplicationController 
    def index 
    @all = params[:all] # "this/is/a/test" 
    @path = request.path # "/this/is/a/test" 
    @query = request.query_parameters # {"option"=>"true"} 
    end 
end 
+0

안녕 Sinetris, 그것은 고마워 많이 일했습니다. – sameera207