diff options
author | Emilio Tagua <miloops@gmail.com> | 2011-02-18 15:55:55 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2011-02-18 15:55:55 -0300 |
commit | 49f3525f19a78b478367f997522197d03e8694ce (patch) | |
tree | 84098f3ee9dc222ad02413c3b15608dadec9a5e3 | |
parent | eb23b2247d84df104bccb456b45e6e61b8157ef8 (diff) | |
download | rails-49f3525f19a78b478367f997522197d03e8694ce.tar.gz rails-49f3525f19a78b478367f997522197d03e8694ce.tar.bz2 rails-49f3525f19a78b478367f997522197d03e8694ce.zip |
Initialize @target instead asking if it is defined.
-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 |