2011-11-09 6 views
0

routes.rb 파일에 다음과 같은 중첩 된 자원을 가지고있다. 내부 리소스는 컨트롤러 이름을 지정합니다. 이 페이지 (/sets/1/tags/new를)로드하려고레일 : "어떤 경로가 일치하지 않습니다"

<%= form_for [@batch, @tag], :url => batch_tag_path do |f| %> 
    ... 
<% end %> 

나에게 ActionController을 제공 :: RoutingError을 메시지와 함께 :

BatchesTags#new의 관점에서
resources :batches, :except => [:new], :path => "sets" do 
    resources :tags, :controller => "batches_tags" 
end 

, 나는 양식을 구축을 위해 노력하고있다

{: action => "show"와 일치하는 경로가 없음, : controller => "batches_tags"}

하지만 $ rake routes을 실행할 때, 그것은 분명이 경로 이 존재 보여줍니다

batch_tag GET /sets/:batch_id/tags/:id(.:format)  {:action=>"show", :controller=>"batches_tags"} 

사람이 오류를 해결하는 방법을 알고 있나요?

편집 : Batches#show의 관점에서

, 나는 같은 batch_tag_path 기능과 완벽하게 작동 사용

<%= link_to "...", batch_tag_path(@batch, tag) %> 
+0

내가 혼란 스러워요 ... 당신은 당신이/새로운 액션로드를 시도한다고 가정하지만, 라우터는 쇼에 대한 오류를 다시 던지고있다. 일괄 처리 및 태그에 대한 rake_routes의 전체 출력은 어떻게됩니까? –

답변

0

그것은 batch_tag_path 유효한 경로 (동안, 밝혀 제작하지 않습니다이 $ rake routes 출력에서 ​​볼 수 있듯이 오류 메시지가 매우 혼란은) 내가 필요 경로가, batch_tags_path을 복수로했다 "어떤 노선은 일치"

,
batch_tags GET /sets/:batch_id/tags(.:format) {:action=>"index", :controller=>"batches_tags"} 
      POST /sets/:batch_id/tags(.:format) {:action=>"create", :controller=>"batches_tags"} 

아마도 오류 메시지는 batch_tag_path이 올바른 POST 경로가 아니란 것을 의미합니까?

관련 문제