aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorNicholas Seckar <nseckar@gmail.com>2006-02-02 05:41:00 +0000
committerNicholas Seckar <nseckar@gmail.com>2006-02-02 05:41:00 +0000
commit1bce58b31289362d62863ad0600b924858a11e34 (patch)
treea99ebc764c8e91e04b490bd6145a5201341e50c3 /activerecord
parent4bb6f863b42814707c0df6d972c931c6925b3de8 (diff)
downloadrails-1bce58b31289362d62863ad0600b924858a11e34.tar.gz
rails-1bce58b31289362d62863ad0600b924858a11e34.tar.bz2
rails-1bce58b31289362d62863ad0600b924858a11e34.zip
Add Reloadable::OnlySubclasses which handles the common case where a base class should not be reloaded, but its subclasses should be.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3521 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord')
-rwxr-xr-xactiverecord/lib/active_record/base.rb5
-rw-r--r--activerecord/lib/active_record/observer.rb7
2 files changed, 5 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index f134402c58..aa13dc6d68 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -242,9 +242,10 @@ module ActiveRecord #:nodoc:
# Accepts a logger conforming to the interface of Log4r or the default Ruby 1.8+ Logger class, which is then passed
# on to any new database connections made and which can be retrieved on both a class and instance level by calling +logger+.
cattr_accessor :logger
-
+
+ include Reloadable::OnlySubclasses
+
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 d43909c3c5..ae0d7560e2 100644
--- a/activerecord/lib/active_record/observer.rb
+++ b/activerecord/lib/active_record/observer.rb
@@ -83,11 +83,8 @@ module ActiveRecord
# 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
-
+ include Reloadable::OnlySubclasses
+
# Attaches the observer to the supplied model classes.
def self.observe(*models)
define_method(:observed_class) { models }