Skip to content

Commit

Permalink
Tweak the Rails load order so observers are loaded after plugins, and…
Browse files Browse the repository at this point in the history
… reloaded in development mode. Closed #5279.  [Rick Olson]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4684 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
technoweenie committed Aug 6, 2006
1 parent e8f0b1d commit 26eefd7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 2 additions & 0 deletions railties/CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
*SVN*

* Tweak the Rails load order so observers are loaded after plugins, and reloaded in development mode. Closed #5279. [Rick Olson]

* Added that you can change the web server port in config/lighttpd.conf from script/server --port/-p #5465 [mats@imediatec.co.uk]

* script/performance/profiler compatibility with the new ruby-prof, including an option to choose the results printer. #5679 [shugo@ruby-lang.org]
Expand Down
2 changes: 1 addition & 1 deletion railties/lib/dispatcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def dispatch(cgi = nil, session_options = ActionController::CgiRequest::DEFAULT_
# to restart the server (WEBrick, FastCGI, etc.).
def reset_application!
Dependencies.clear
ActiveRecord::Base.reset_subclasses
ActiveRecord::Base.reset
Class.remove_class(*Reloadable.reloadable_classes)
end

Expand Down
11 changes: 9 additions & 2 deletions railties/lib/initializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def initialize(configuration)
# * #initialize_framework_settings
# * #load_environment
# * #load_plugins
# * #load_observers
# * #initialize_routing
#
# (Note that #load_environment is invoked twice, once at the start and
Expand All @@ -89,7 +90,6 @@ def process
initialize_breakpoints
initialize_whiny_nils
initialize_temporary_directories

initialize_framework_settings

# Support for legacy configuration style where the environment
Expand All @@ -100,6 +100,9 @@ def process
add_support_load_paths

load_plugins

# Observers are loaded after plugins in case Observers or observed models are modified by plugins.
load_observers

# Routing must be initialized after plugins to allow the former to extend the routes
initialize_routing
Expand Down Expand Up @@ -171,7 +174,11 @@ def load_environment
end
end
end


def load_observers
ActiveRecord::Base.instantiate_observers
end

# This initialization routine does nothing unless <tt>:active_record</tt>
# is one of the frameworks to load (Configuration#frameworks). If it is,
# this sets the database configuration from Configuration#database_configuration
Expand Down

0 comments on commit 26eefd7

Please sign in to comment.