2013-09-27 3 views
0

내 앱이 내 홈 페이지, 즉 posts # index로 리디렉션하도록합니다. 레일즈 3으로 이전하려고하는 레일즈 2 앱입니다.충돌시 홈 페이지로 리디렉션

def rescue_action_in_public(exception) 
    flash[:notice] = "There was an error. Please try again." # #{exception} 
    redirect_to :controller => :posts, :action => :index 
end 

이 방법으로 추정합니다. 얼마나 오래, 그것은 레일 3에서 작동하지 않을 것입니다. 그리고 나는 '죄송합니다. 페이지

이 기능을 레일 3에서 어떻게 작동시킬 수 있습니까? 더 많은 정보가 필요하다면 여기에 붙여 넣으 려합니다. 레일

답변

0

def rescue_action_in_public(exception) 
     status = status_code(exception) 
     locale_path = "#{public_path}/#{status}.#{I18n.locale}.html" if I18n.locale 
     path = "#{public_path}/#{status}.html" 

     if locale_path && File.exist?(locale_path) 
      render(status, File.read(locale_path)) 
     elsif File.exist?(path) 
      render(status, File.read(path)) 
     else 
      render(status, '') 
     end 
     end 

0

apidock에서 당신이 할 수있는 바로이 방법을 시도 3!

def rescue_action_in_public(exception) 
    flash[:notice] = "There was an error. Please try again." # #{exception} 
    redirect_to posts_path 
end 
관련 문제