diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-07-01 14:37:31 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-07-01 14:38:22 -0700 |
commit | 2ed80970580da7c95644b48d2817fc9a84e7bef6 (patch) | |
tree | 460abbc46b0f72a50664f44969a7fdaf0138da13 /activerecord/lib/active_record | |
parent | 06c72c43bac5608a9b0623506782144f80e1b150 (diff) | |
download | rails-2ed80970580da7c95644b48d2817fc9a84e7bef6.tar.gz rails-2ed80970580da7c95644b48d2817fc9a84e7bef6.tar.bz2 rails-2ed80970580da7c95644b48d2817fc9a84e7bef6.zip |
calling super is super. if the other object is exactly equal, we can return early
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/reflection.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb index 894d56b3a0..a2324039cf 100644 --- a/activerecord/lib/active_record/reflection.rb +++ b/activerecord/lib/active_record/reflection.rb @@ -130,7 +130,11 @@ module ActiveRecord # Returns +true+ if +self+ and +other_aggregation+ have the same +name+ attribute, +active_record+ attribute, # and +other_aggregation+ has an options hash assigned to it. def ==(other_aggregation) - other_aggregation.kind_of?(self.class) && name == other_aggregation.name && other_aggregation.options && active_record == other_aggregation.active_record + super || + other_aggregation.kind_of?(self.class) && + name == other_aggregation.name && + other_aggregation.options && + active_record == other_aggregation.active_record end def sanitized_conditions #:nodoc: |