2014-04-24 3 views
1

내가 4마이그레이션 경로는 4

몇 가지 문제를 만들어 내 능숙에 대한 몇 가지 추가 경로가 있습니다 레일 3 응용 프로그램을 내 레일을 마이그레이션에 대한 생각 레일. 나는 나의 경로 파일에이 라인에 대한 오류 메시지가 :

resources :teams do 
... 
    get 'apply' => 'teams#apply_membership', as: :apply_membership 
    post 'apply' => 'teams#apply_membership_save', as: :apply_membership 
... 

이것은 생성 된 오류 메시지 rails3 GET 및이를 이용한 포스트 경로를 정의 할 수 있었다에서

You may have defined two routes with the same name using the `:as` option, or you may be overriding a route already defined by a resource with the same naming. For the latter, you can restrict the routes created with `resources` as explained here: 
http://guides.rubyonrails.org/routing.html#restricting-the-routes-created 

별칭을 만들고 다른 컨트롤 메서드로 라우팅합니다.

rails4에서도이 작업을 수행 할 수 있습니까? 그렇다면 경로 파일에서 어떻게 보이야합니까?

답변

1

동일한 이름의 경로 이름을 두 개 사용할 수 없습니다. 그러나 당신은 그것을했습니다. 그래서 변경하십시오.

get 'apply' => 'teams#apply_membership', as: :apply_membership 
post 'apply' => 'teams#apply_membership_save', as: :update_membership 

레일 라우팅을 보려면 여기를 클릭하십시오. http://guides.rubyonrails.org/routing.html

관련 문제