Add LoadingModule.clear! back temporarily

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3524 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Nicholas Seckar
2006-02-02 16:56:15 +00:00
parent 1129e5b915
commit 6d7b0374d1
2 changed files with 9 additions and 0 deletions

View File

@@ -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:

View File

@@ -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)