aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/application_controller.rb5
-rw-r--r--app/controllers/general_controller.rb6
2 files changed, 10 insertions, 1 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index b8bdc403c..62479f200 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -12,6 +12,8 @@ require 'open-uri'
class ApplicationController < ActionController::Base
class PermissionDenied < StandardError
end
+ class RouteNotFound < StandardError
+ end
# assign our own handler method for non-local exceptions
rescue_from Exception, :with => :render_exception
@@ -128,7 +130,7 @@ class ApplicationController < ActionController::Base
@exception_class = exception.class.to_s
@exception_message = exception.message
case exception
- when ActiveRecord::RecordNotFound
+ when ActiveRecord::RecordNotFound, RouteNotFound
@status = 404
when PermissionDenied
@status = 403
@@ -173,6 +175,7 @@ class ApplicationController < ActionController::Base
render :template => "general/exception_caught", :status => @status
end
+
# FIXME: This was disabled during the Rails 3 upgrade as this is now handled by Rack
# # For development sites.
# alias original_rescue_action_locally rescue_action_locally
diff --git a/app/controllers/general_controller.rb b/app/controllers/general_controller.rb
index 0df685829..9d0f91dda 100644
--- a/app/controllers/general_controller.rb
+++ b/app/controllers/general_controller.rb
@@ -222,5 +222,11 @@ class GeneralController < ApplicationController
@locale = self.locale_from_params()
render(:layout => false, :content_type => 'text/css')
end
+
+ # Handle requests for non-existent URLs - will be handled by ApplicationController::render_exception
+ def not_found
+ raise RouteNotFound
+ end
+
end