2011-09-15 5 views
1

내가 설정을 가지고 문제를 재 '가 로컬 호스트 : 3000/특성/2/단위/3/편집'레일 내 레일 응용 프로그램에서 몇 가지 간단한 협회

다시 적절한 위치로 리디렉션하고 싶습니다. 내가 "업데이트"나는 다시 리디렉션하고 클릭 한 후

:

를 '로컬 호스트 : 3000/단위/3' ': 3000/특성/2/단위/3/localhost를'

,하지만 가야한다 내 장치 컨트롤러에서

, 내가 가진 :

if @unit.update_attributes(params[:unit]) 
    format.html { redirect_to(property_units_path(@property, @unit), :notice => 'Unit was successfully updated.') } 
    format.xml { head :ok } 
    else 
    format.html { render :action => "edit" } 
    format.xml { render :xml => @unit.errors, :status => :unprocessable_entity } 
    end 

이 내 redirect_to 함수의 적절한 사용합니까? 나는 아직도 길 작동 방식에 익숙해 지려고 노력하고 있지만 이것이 효과가 있어야한다고 생각하니?

감사합니다.

답변

0

거의 다 왔어. 당신이 작동하지 라우팅 도우미 메서드의 단일 버전을 사용해야합니다

format.html { redirect_to(property_unit_path(@property, @unit), :notice => 'Unit was successfully updated.') } 

참고 : 당신은 리디렉션합니다. 자세한 내용은 레일 가이드 routing을 확인하십시오.