Skip to content
Browse files

Rescue from ActionController::RoutingError with a 404 page.

  • Loading branch information...
1 parent 0e4afbc commit f07179b6e4c69928b58f3d403345abf2e075d8bc @nrr nrr committed with Aug 24, 2012
Showing with 12 additions and 0 deletions.
  1. +12 −0 rails/app/controllers/application_controller.rb
View
12 rails/app/controllers/application_controller.rb
@@ -9,6 +9,18 @@ class ApplicationController < ActionController::Base
around_filter :transaction_wrapper
before_filter :automatic_token_check
+ rescue_from ActionController::RoutingError, :with => :not_found
+
+ private
+
+ def not_found( exception = nil )
+ unless exception.nil?
+ logger.info "Not found: #{exception.message}"
+ end
+
+ render :file => "#{Rails.root}/public/404.html", :status => 404, :layout => false
+ end
+
protected
def local( tag, arguments = {} )

0 comments on commit f07179b

Please sign in to comment.
Something went wrong with that request. Please try again.