From 651e57a72c2f53add43989c3aefa5ef843ed02a7 Mon Sep 17 00:00:00 2001 From: Rick Olson Date: Wed, 9 Aug 2006 16:52:42 +0000 Subject: [PATCH] Rearrange application resetting and preparation, fix bug with leaking subclasses hash in ActiveRecord::Base [Rick Olson] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4742 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- railties/CHANGELOG | 5 +++++ railties/lib/dispatcher.rb | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/railties/CHANGELOG b/railties/CHANGELOG index 168d0c6b78..8bf2fafd6e 100644 --- a/railties/CHANGELOG +++ b/railties/CHANGELOG @@ -1,5 +1,10 @@ *SVN* +* Rearrange application resetting and preparation, fix bug with leaking subclasses hash in ActiveRecord::Base [Rick Olson] + + ActiveRecord::Base.reset_subclasses is called before Dependencies are cleared and classes removed. + ActiveRecord::Base.instantiate_observers is called during a Dispatcher preparation callback. + * Add missing mock directories from the autoload_paths configuration. [Rick Olson] * Nested controller scaffolding also nests the generated layout. [iain d broadfoot] diff --git a/railties/lib/dispatcher.rb b/railties/lib/dispatcher.rb index 2a882ae1b4..17e5ae74f7 100644 --- a/railties/lib/dispatcher.rb +++ b/railties/lib/dispatcher.rb @@ -54,9 +54,9 @@ def dispatch(cgi = nil, session_options = ActionController::CgiRequest::DEFAULT_ # mailers, and so forth. This allows them to be loaded again without having # to restart the server (WEBrick, FastCGI, etc.). def reset_application! + ActiveRecord::Base.reset_subclasses if defined?(ActiveRecord) Dependencies.clear Class.remove_class(*Reloadable.reloadable_classes) - ActiveRecord::Base.reset if defined?(ActiveRecord) end @@ -159,3 +159,7 @@ def failsafe_response(output, status, exception = nil) self.preparation_callbacks_run = false end + +Dispatcher.to_prepare :activerecord_instantiate_observers do + ActiveRecord::Base.instantiate_observers +end if defined?(ActiveRecord) -- GitLab