aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-01-25 18:20:23 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-01-25 18:20:23 +0000
commitbe80d460f7389d3b5db7248cc4fb726fa61db4e4 (patch)
treece32727bbd72d6444b9f4755a481d1bbad0c46d3
parent20b14e0d3809d9af8e53dcf598a74362adbd7439 (diff)
downloadrails-be80d460f7389d3b5db7248cc4fb726fa61db4e4.tar.gz
rails-be80d460f7389d3b5db7248cc4fb726fa61db4e4.tar.bz2
rails-be80d460f7389d3b5db7248cc4fb726fa61db4e4.zip
Moved subclass reloading responsibilities to Dependencies
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@509 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r--activesupport/lib/dependencies.rb4
-rw-r--r--railties/lib/dispatcher.rb4
2 files changed, 5 insertions, 3 deletions
diff --git a/activesupport/lib/dependencies.rb b/activesupport/lib/dependencies.rb
index 3ceec71873..e5e806b65a 100644
--- a/activesupport/lib/dependencies.rb
+++ b/activesupport/lib/dependencies.rb
@@ -35,6 +35,10 @@ module Dependencies
def require_or_load(file_name)
load? ? load("#{file_name}.rb") : require(file_name)
end
+
+ def remove_subclasses_for(*classes)
+ classes.each { |klass| klass.remove_subclasses }
+ end
end
Object.send(:define_method, :require_or_load) { |file_name| Dependencies.require_or_load(file_name) } unless Object.respond_to?(:require_or_load)
diff --git a/railties/lib/dispatcher.rb b/railties/lib/dispatcher.rb
index 84dff75024..566b031295 100644
--- a/railties/lib/dispatcher.rb
+++ b/railties/lib/dispatcher.rb
@@ -49,9 +49,7 @@ class Dispatcher
private
def reset_application
Dependencies.clear
- ActiveRecord::Base.remove_subclasses
- ActiveRecord::Observer.remove_subclasses
- ActionController::Base.remove_subclasses
+ Dependencies.remove_subclasses_for(ActiveRecord::Base, ActiveRecord::Observer, ActionController::Base)
end
def controller_path(controller_name, module_name = nil)