Ruby On Rails: Viewing 404 in development

Wingy

[H]ard|Gawd
Joined
Dec 18, 2000
Messages
1,294
Hey,

I'm doing a basic project in Ruby on Rails, and want to test my routing, and error pages. I'd like to do this in my development environment. I've gone into config/environments/development.rb and set:

Code:
config.action_controller.consider_all_requests_local = false

But when I go to an improper route, I don't get public/404.html rendered. I continue to get the routing error page:

Code:
Routing Error

No route matches "/badroute" with {:method=>:get}

Is there a better way to check this? I'd like to see how rails handles the routing errors by default, and what the 404 will cover, than maybe add some complex error handling after.

Thanks for the help!
 
Forgot about the thread, but the solution(s) are simple.

Instead of testing by directing your browser to http://localhost..., use your IP.

OR

If you ant to undo some this aspect of working on the machine local to the application, you can override the rescue_from_action_locally to call rescue_from_action_in_public. Then n exceptions you're handling will be passed to the public handler.

I chose to just use my IP, as I prefer to switch over to the localhost to quickly view any debug information I need. You could also set some global environment variable in solution 2 that would control the local handling.
 
Back
Top