aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2006-01-29 00:37:39 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2006-01-29 00:37:39 +0000
commit01b1a8772928fbf31180341356981b95d0581413 (patch)
tree16d9939a713b79c91f5a14c799fb4e12790ecfff /activerecord/lib
parent94046542e274f76ec9d31721a73a19e4b651fbfc (diff)
downloadrails-01b1a8772928fbf31180341356981b95d0581413.tar.gz
rails-01b1a8772928fbf31180341356981b95d0581413.tar.bz2
rails-01b1a8772928fbf31180341356981b95d0581413.zip
Added reusable reloading support through the inclusion of the Relodable module that all subclasses of ActiveRecord::Base, ActiveRecord::Observer, ActiveController::Base, and ActionMailer::Base automatically gets [DHH]. Added auto-loading support for classes in modules, so Conductor::Migration will look for conductor/migration.rb and Conductor::Database::Settings will look for conductor/database/settings.rb [Nicholas Seckar]. Refactored extensions to module, class, and object in active support [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3493 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-xactiverecord/lib/active_record/base.rb1
-rw-r--r--activerecord/lib/active_record/observer.rb7
2 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index d05e3c6cae..f134402c58 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -244,6 +244,7 @@ module ActiveRecord #:nodoc:
cattr_accessor :logger
def self.inherited(child) #:nodoc:
+ child.send :include, Reloadable
@@subclasses[self] ||= []
@@subclasses[self] << child
super
diff --git a/activerecord/lib/active_record/observer.rb b/activerecord/lib/active_record/observer.rb
index 7d33509c8c..d43909c3c5 100644
--- a/activerecord/lib/active_record/observer.rb
+++ b/activerecord/lib/active_record/observer.rb
@@ -81,6 +81,13 @@ module ActiveRecord
class Observer
include Singleton
+ # Observer subclasses should be reloaded by the dispatcher in Rails
+ # when Dependencies.mechanism = :load.
+ def self.inherited(child) #:nodoc:
+ child.send :include, Reloadable
+ super
+ end
+
# Attaches the observer to the supplied model classes.
def self.observe(*models)
define_method(:observed_class) { models }