본문 바로가기
개발/Ruby on rails

[Ruby on rails] 로컬 개발 환경에서 500.html 확인하는법 - How to test 500.html in rails development env

by 유노~ 2014. 2. 23.
반응형

로컬 개발 환경에서 500 error pages 를 보려고 할때

config 설정에  아래와 같이 consider_allrequests_local 를 false 를 설정해 놓았는데도

full error 메시지만 나와 당황스러운 경험을 했다.


config/environments/development.rb:

config.action_controller.consider_all_requests_local = false


내가보고 싶은 에러메시지 화면은 아래와 같은것인데.

We're sorry, but something went wrong.




config 설정를 아래처럼 한것처럼  아래 화면 처럼 full error message 만 나왔다.

config.action_controller.consider_all_requests_local = true



이럴때는 

어플리케이션 주소로 localhost or 127.0.0.1 로 하고 있다면 다른주소로 접근하면 된다.


이 간단한걸 몰라 한참을 해맸다.



아래는 stack overflow 에서 찾은 나와 비슷한 문제에 대한 질문 답변

http://stackoverflow.com/questions/4156490/how-to-test-500-html-in-rails-development-env

질문

I want to test the 500 error pages in my Rails app using the development environment.

I already tried this in config/environments/development.rb:

config.action_controller.consider_all_requests_local = false

But this does not seem to have any effect.


답변

  1. access the application using address other than localhost or 127.0.0.1 which rails considers by default to be local requests
  2. Override local_request? in application_controller.rb to something like:
def local_request?
  false
end


반응형