레일스 3에서 "알 수없는 작업"오류 및 개발 중 404.html 오류를 표시하고 싶습니다. 내처리기를 내 ApplicationController (및 경우에 따라서는 실제 컨트롤러)에 넣으려고했는데 여전히 추한 오류가 표시됩니다.레일 3에서 사용자 정의 404에 대한 알 수없는 작업 캐치
나는 404에 사용자 지정 항목이 있으며 일반 .html 파일이 될 수 없습니다.
내 경로 :
match '/user/:id/:action', controller: 'users'
의 URL 내가 접근 해요 : /user/elado/xxx
rescue_from
코드 :
rescue_from AbstractController::ActionNotFound, :with => :action_not_found
def action_not_found
render text: "action_not_found"
end
브라우저에서 오류 :
Unknown action
The action 'xxx' could not be found for UsersController
그리고 콘솔 :
Started GET "/user/elado/xxx" for 127.0.0.1 at 2011-09-07 19:16:27 -0700
AbstractController::ActionNotFound (The action 'xxx' could not be found for UsersController):
도 rescue_from ActionController::UnknownAction
시도.
제안 사항? 감사합니다.
다음 링크는 좋은 통찰력을 제공하며 예외 (3.2 이상)를보다 잘 처리하는 방법의 예를 제공합니다. http://geekmonkey.org/articles/29-exception-applications-in-rails-3-2 – Agustin