가 어떻게레일
{:controller => 'controller_name', :action => 'action_name', :id => 'id'}
같은 해시 URL 문자열을 구문 분석 할 수 있습니다 (경로)를 해시 URL을 구문 분석?
가 어떻게레일
{:controller => 'controller_name', :action => 'action_name', :id => 'id'}
같은 해시 URL 문자열을 구문 분석 할 수 있습니다 (경로)를 해시 URL을 구문 분석?
을 사용하면 다음을 수행 할 수 ActionController :: 라우팅을 사용
Rails.application.routes.recognize_path "/accounts/1"
# {:action=>"show", :controller=>"accounts", :id=>"1"}
을 :: Routes.recognize_path가 계속 던져서 ActionController :: RoutingError 예외 : "/ accounts/1에 일치하는 경로가 없습니다.
당신은 URL의 형식에 따라 ActionController::Routing::Routes.recognize_path
를 사용할 수 있습니다 : 레일 3에서
>> ActionController::Routing::Routes.recognize_path("/accounts/1",:method=>:get)`
# {:action=>"show":controller=>"accounts",:id=>"1"}
URL의 형식에 따라 달라집니다. –
나는 URL 형식에 관계없이 같은 질문을한다. ie url_for의 역은 무엇입니까? – Corin