Search code examples
ruby-on-railsdevelopment-environment

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.


Solution

  • You can either:

    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
    

    The second will stop rails treating requests from localhost and 127.0.0.1 as local requests which combined with consider_all_requests_local = false should show you your 500.html page.