Reputation: 7084
This is a follow up to link text about trying to remove the stack trace for routing errors out of my log, and to handle bad routes a little better. Here's my relevant routes.rb entry and controller
map.default '*', :controller => 'error', :action => 'route_not_found'
class ErrorsController < ApplicationController
def route_not_found
logger.error("routing error for " + request.url)
end
end
I also tried map.connect, as that was recommended in a related thread, but that didn't work either. Does the named route 'map.default' have a special meaning?
Upvotes: 0
Views: 349
Reputation: 30452
map.connect '*path', :controller => 'error', :action => 'route_not_found'
as the very last route should work as you expect (see here under 'Route Globbing'). If you hit that route what is happening? Also, have you restarted your server when changing routes?
Upvotes: 3
Reputation: 4711
There are some articles about how to render custom rails error pages: http://www.perfectline.co.uk/blog/custom-dynamic-error-pages-in-ruby-on-rails
See also: Custom Error Pages in Rails?
Note that those errors are shown in production mode only (by default).
Upvotes: 1