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?

1
  • why has no one answered this yet..... seems pretty trivial and yet I don't know the answer. Commented Sep 10, 2015 at 21:43

2 Answers 2

10

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

Sign up to request clarification or add additional context in comments.

1 Comment

What if they're not static?
1

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

rails s -e production

cheers.

1 Comment

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.