diff options
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/observer.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/observer.rb b/activerecord/lib/active_record/observer.rb index 74f76efe3f..36a9ec5d3a 100644 --- a/activerecord/lib/active_record/observer.rb +++ b/activerecord/lib/active_record/observer.rb @@ -58,7 +58,9 @@ module ActiveRecord end def initialize - [ observed_class ].flatten.each do |klass| + observed_classes = [ observed_class ].flatten + observed_subclasses_class = observed_classes.collect {|c| c.send(:subclasses) }.flatten! + (observed_classes + observed_subclasses_class).each do |klass| klass.add_observer(self) klass.send(:define_method, :after_find) unless klass.respond_to?(:after_find) end |