Skip to content

Commit

Permalink
Moved subclass reloading responsibilities to Dependencies
Browse files Browse the repository at this point in the history
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@509 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
dhh committed Jan 25, 2005
1 parent 20b14e0 commit be80d46
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 4 additions & 0 deletions activesupport/lib/dependencies.rb
Expand Up @@ -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)
Expand Down
4 changes: 1 addition & 3 deletions railties/lib/dispatcher.rb
Expand Up @@ -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)
Expand Down

0 comments on commit be80d46

Please sign in to comment.