aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--activesupport/lib/active_support/dependencies.rb8
-rw-r--r--railties/lib/dispatcher.rb1
2 files changed, 9 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/dependencies.rb b/activesupport/lib/active_support/dependencies.rb
index 7f73f9bf40..0bedbf093c 100644
--- a/activesupport/lib/active_support/dependencies.rb
+++ b/activesupport/lib/active_support/dependencies.rb
@@ -142,6 +142,14 @@ module Dependencies #:nodoc:
def const_available?(name)
self.const_defined?(name) || load_paths.any? {|lp| lp.filesystem_path(path + [name])}
end
+
+ # Erase all items in this module
+ def clear!
+ constants.each do |name|
+ Object.send(:remove_const, name) if Object.const_defined?(name) && Object.const_get(name).object_id == self.const_get(name).object_id
+ self.send(:remove_const, name)
+ end
+ end
end
class RootLoadingModule < LoadingModule #:nodoc:
diff --git a/railties/lib/dispatcher.rb b/railties/lib/dispatcher.rb
index 0d7ca34ea4..6bc61889d1 100644
--- a/railties/lib/dispatcher.rb
+++ b/railties/lib/dispatcher.rb
@@ -50,6 +50,7 @@ class Dispatcher
# mailers, and so forth. This allows them to be loaded again without having
# to restart the server (WEBrick, FastCGI, etc.).
def reset_application!
+ Controllers.clear!
Dependencies.clear
ActiveRecord::Base.reset_subclasses
Class.remove_class(*Reloadable.reloadable_classes)