aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord')
-rwxr-xr-xactiverecord/lib/active_record/base.rb1
-rw-r--r--activerecord/lib/active_record/observer.rb7
-rw-r--r--activerecord/test/class_inheritable_attributes_test.rb2
3 files changed, 9 insertions, 1 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 }
diff --git a/activerecord/test/class_inheritable_attributes_test.rb b/activerecord/test/class_inheritable_attributes_test.rb
index 3419ffbd9a..a3f94e3abb 100644
--- a/activerecord/test/class_inheritable_attributes_test.rb
+++ b/activerecord/test/class_inheritable_attributes_test.rb
@@ -1,6 +1,6 @@
require 'test/unit'
require 'abstract_unit'
-require 'active_support/class_inheritable_attributes'
+require 'active_support/core_ext/class/inheritable_attributes'
class A
include ClassInheritableAttributes