Permalink
Browse files

Moved subclass reloading responsibilities to Dependencies

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@509 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 20b14e0 commit be80d460f7389d3b5db7248cc4fb726fa61db4e4 @dhh dhh committed Jan 25, 2005
Showing with 5 additions and 3 deletions.
  1. +4 −0 activesupport/lib/dependencies.rb
  2. +1 −3 railties/lib/dispatcher.rb
@@ -35,6 +35,10 @@ def clear
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)
@@ -49,9 +49,7 @@ def dispatch(cgi = CGI.new, session_options = ActionController::CgiRequest::DEFA
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)

0 comments on commit be80d46

Please sign in to comment.