diff options
author | Rick Olson <technoweenie@gmail.com> | 2008-02-02 20:18:18 +0000 |
---|---|---|
committer | Rick Olson <technoweenie@gmail.com> | 2008-02-02 20:18:18 +0000 |
commit | 5ef2b089f03271fcff02280fdcbb12d38d726eba (patch) | |
tree | be223e13b3ee27c5c1d063bec186d6d9bd21f6a0 /activerecord/lib | |
parent | 0da2aa6d11b6cb8433a12a6707355cc15506583a (diff) | |
download | rails-5ef2b089f03271fcff02280fdcbb12d38d726eba.tar.gz rails-5ef2b089f03271fcff02280fdcbb12d38d726eba.tar.bz2 rails-5ef2b089f03271fcff02280fdcbb12d38d726eba.zip |
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
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/observer.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/observer.rb b/activerecord/lib/active_record/observer.rb index cfdeae3592..6e4db637f5 100644 --- a/activerecord/lib/active_record/observer.rb +++ b/activerecord/lib/active_record/observer.rb @@ -125,6 +125,20 @@ module ActiveRecord # # 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 include Singleton |