mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Reshuffle load order so that routes and observers are initialized after plugins and app initializers. Closes #10980 [rick, fxn]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8787 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
0da2aa6d11
commit
5ef2b089f0
4 changed files with 24 additions and 6 deletions
|
@ -1,5 +1,7 @@
|
||||||
*SVN*
|
*SVN*
|
||||||
|
|
||||||
|
* Add note about how ActiveRecord::Observer classes are initialized in a Rails app. #10980 [fxn]
|
||||||
|
|
||||||
* MySQL: omit text/blob defaults from the schema instead of using an empty string. #10963 [mdeiters]
|
* MySQL: omit text/blob defaults from the schema instead of using an empty string. #10963 [mdeiters]
|
||||||
|
|
||||||
* belongs_to supports :dependent => :destroy and :delete. #10592 [Jonathan Viney]
|
* belongs_to supports :dependent => :destroy and :delete. #10592 [Jonathan Viney]
|
||||||
|
|
|
@ -125,6 +125,20 @@ module ActiveRecord
|
||||||
#
|
#
|
||||||
# Observers will not be invoked unless you define these in your application configuration.
|
# Observers will not be invoked unless you define these in your application configuration.
|
||||||
#
|
#
|
||||||
|
# == Loading
|
||||||
|
#
|
||||||
|
# Observers register themselves in the model class they observe, since it is the class that
|
||||||
|
# notifies them of events when they occur. As a side-effect, when an observer is loaded its
|
||||||
|
# corresponding model class is loaded.
|
||||||
|
#
|
||||||
|
# Up to (and including) Rails 2.0.2 observers were instantiated between plugins and
|
||||||
|
# application initializers. Now observers are loaded after application initializers,
|
||||||
|
# so observed models can make use of extensions.
|
||||||
|
#
|
||||||
|
# If by any chance you are using observed models in the initialization you can still
|
||||||
|
# load their observers by calling <tt>ModelObserver.instance</tt> before. Observers are
|
||||||
|
# singletons and that call instantiates and registers them.
|
||||||
|
#
|
||||||
class Observer
|
class Observer
|
||||||
include Singleton
|
include Singleton
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
*SVN*
|
*SVN*
|
||||||
|
|
||||||
|
* Reshuffle load order so that routes and observers are initialized after plugins and app initializers. Closes #10980 [rick]
|
||||||
|
|
||||||
* Git support for script/generate. #10690 [ssoroka]
|
* Git support for script/generate. #10690 [ssoroka]
|
||||||
|
|
||||||
* Update scaffold to use labels instead of bold tags. Closes #10757 [zach-inglis-lt3]
|
* Update scaffold to use labels instead of bold tags. Closes #10757 [zach-inglis-lt3]
|
||||||
|
|
|
@ -87,16 +87,16 @@ module Rails
|
||||||
|
|
||||||
load_plugins
|
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
|
|
||||||
|
|
||||||
# the framework is now fully initialized
|
# the framework is now fully initialized
|
||||||
after_initialize
|
after_initialize
|
||||||
|
|
||||||
load_application_initializers
|
load_application_initializers
|
||||||
|
|
||||||
|
# Routing must be initialized after plugins to allow the former to extend the routes
|
||||||
|
initialize_routing
|
||||||
|
|
||||||
|
# Observers are loaded after plugins in case Observers or observed models are modified by plugins.
|
||||||
|
load_observers
|
||||||
end
|
end
|
||||||
|
|
||||||
# Check for valid Ruby version
|
# Check for valid Ruby version
|
||||||
|
|
Loading…
Reference in a new issue