7

I want to design my 404 page in my Rails 3.0.7 app. If I request a non existing page I get the development output

    Routing Error

    No route matches "/foo"

I tried the following answers in:

How to test 500.html in rails development env?

application_controller:

def local_request?
  false
end

development.rb:

config.consider_all_requests_local = false

development.rb:

config.action_view.debug_rjs = false

and I also started my app with: RAILS_ENV=production rails s RAILS_ENV=production passenger start

None of it worked.I love how rails makes complicated tasks very simple. But it's really frustrating how really simple things turn out tu be overwhelmingly difficult, impossible to debug and you end up hacking on remote servers to work around it..

Has anyone had this problem before?

Community
  • 1
  • 1
Axel Tetzlaff
  • 1,355
  • 8
  • 11

2 Answers2

10

If your error pages are static you can simply go to http://localhost:3000/404.html, http://localhost:3000/500.html, etc.

James
  • 4,797
  • 25
  • 29
1

Best idea I've come up with so far is to run the server in production mode locally.

rails s -e production

cheers.

Nick Res
  • 2,154
  • 5
  • 30
  • 48
  • This is not always doable. Most application servers would require plenty of configuration setup for an actual production environment, without which the server won't even start with `-e production` flag locally. – Masroor Mar 16 '22 at 13:13