aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/dispatcher.rb
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/dispatcher.rb')
-rw-r--r--railties/lib/dispatcher.rb19
1 files changed, 10 insertions, 9 deletions
diff --git a/railties/lib/dispatcher.rb b/railties/lib/dispatcher.rb
index 1455168ba9..aaea8dd277 100644
--- a/railties/lib/dispatcher.rb
+++ b/railties/lib/dispatcher.rb
@@ -33,9 +33,16 @@ class Dispatcher
rescue Object => exception
ActionController::Base.process_with_exception(request, response, exception).out(output)
ensure
- reset_application
+ reset_after_dispatch
end
end
+
+ def reset_application!
+ Controllers.clear!
+ Dependencies.clear
+ Dependencies.remove_subclasses_for(ActiveRecord::Base, ActiveRecord::Observer, ActionController::Base)
+ Dependencies.remove_subclasses_for(ActionMailer::Base) if defined?(ActionMailer::Base)
+ end
private
def prepare_application
@@ -44,14 +51,8 @@ class Dispatcher
Controllers.const_load!(:ApplicationController, "application") unless Controllers.const_defined?(:ApplicationController)
end
- def reset_application
- if Dependencies.load?
- Controllers.clear!
- Dependencies.clear
- Dependencies.remove_subclasses_for(ActiveRecord::Base, ActiveRecord::Observer, ActionController::Base)
- Dependencies.remove_subclasses_for(ActionMailer::Base) if defined?(ActionMailer::Base)
- end
-
+ def reset_after_dispatch
+ reset_application! if Dependencies.load?
Breakpoint.deactivate_drb if defined?(BREAKPOINT_SERVER_PORT)
end
end