diff options
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/associations/association.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/association.rb b/activerecord/lib/active_record/associations/association.rb index 32eb9ee542..2eb431dfec 100644 --- a/activerecord/lib/active_record/associations/association.rb +++ b/activerecord/lib/active_record/associations/association.rb @@ -24,6 +24,7 @@ module ActiveRecord def initialize(owner, reflection) reflection.check_validity! + @target = nil @owner, @reflection = owner, reflection @updated = false @@ -42,7 +43,7 @@ module ActiveRecord # Resets the \loaded flag to +false+ and sets the \target to +nil+. def reset @loaded = false - IdentityMap.remove(@target) if defined?(@target) && @target && IdentityMap.enabled? + IdentityMap.remove(@target) if IdentityMap.enabled? && @target @target = nil end |