그래서 .. 하위 컨트롤러에있는 것과 같은 슈퍼 컨트롤러에있는 메소드가 있습니다 .. 항목이 저장되지 않는 경우 redirect_to를 제외하고 모두 ..RoR : 슈퍼 및 하위 분류 컨트롤러
서브 클래스 방법 :
def create
some logic
respond_to do |format|
if @template_object.save
format.html { redirect_to({:controller=>:template_objects,:action=>:build,:id=>@template_object}) }
..
end
슈퍼 방법 :
def create
some logic
respond_to do |format|
if @template_object.save
format.html { redirect_to({:controller=>:objects,:action=>:build,:id=>@object}) }
..
end
이것에 대해 갈 수있는 가장 좋은 방법은 무엇입니까?
는
이 나보다 훨씬 더 우아한 해결책이 될 것으로 보인다. 구현 방법을 자세히 설명해 주시겠습니까? ** redirect_to_completed_template **에 무엇을 전달합니까? 나는 이것을 사용하는 법을 배우고 싶다. – rookieRailer
당신은 당신의 경우에 따라'@ object' 나'@ template_object'처럼 보일 것입니다. 'redirect_to' 라인은 하나 또는 다른 것입니다. – tadman
답장을 보내 주셔서 감사합니다. – rookieRailer