diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-12-09 13:37:15 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-12-09 13:48:37 -0800 |
commit | 0e8280b19322bd3fdd7e18fc6ba35d45e986e611 (patch) | |
tree | d1cdfd5f91e95a77b484c3305017e80f3b47f7ba /activerecord | |
parent | b2a042570cf55c716e44865cf6388f9079a86690 (diff) | |
download | rails-0e8280b19322bd3fdd7e18fc6ba35d45e986e611.tar.gz rails-0e8280b19322bd3fdd7e18fc6ba35d45e986e611.tar.bz2 rails-0e8280b19322bd3fdd7e18fc6ba35d45e986e611.zip |
reuse the superclass methods for shorter codes
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/observer.rb | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/observer.rb b/activerecord/lib/active_record/observer.rb index a09c392f9d..8b011ad9af 100644 --- a/activerecord/lib/active_record/observer.rb +++ b/activerecord/lib/active_record/observer.rb @@ -90,15 +90,11 @@ module ActiveRecord # class Observer < ActiveModel::Observer - def initialize - super - observed_descendants.each { |klass| add_observer!(klass) } - end - protected - def observed_descendants - observed_classes.map { |klass| klass.descendants }.flatten + def observed_classes + klasses = super + klasses + klasses.map { |klass| klass.descendants }.flatten end def add_observer!(klass) |