aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations
diff options
context:
space:
mode:
authorEmilio Tagua <miloops@gmail.com>2010-10-14 12:58:47 -0300
committerEmilio Tagua <miloops@gmail.com>2010-11-19 19:08:28 -0300
commit301dd3d5143077f95bebd434ca2ad1c80c1b5866 (patch)
treebf5d51a1bdc7b9b78303ac6a58c514d9cfb364e9 /activerecord/lib/active_record/associations
parent4f3b8e107ab77848d7982b6a2bde87f4b015a98f (diff)
downloadrails-301dd3d5143077f95bebd434ca2ad1c80c1b5866.tar.gz
rails-301dd3d5143077f95bebd434ca2ad1c80c1b5866.tar.bz2
rails-301dd3d5143077f95bebd434ca2ad1c80c1b5866.zip
Use hash[:Post][1] style identity maps for each table.
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r--activerecord/lib/active_record/associations/association_proxy.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/associations/association_proxy.rb b/activerecord/lib/active_record/associations/association_proxy.rb
index 2024cee968..52cb164550 100644
--- a/activerecord/lib/active_record/associations/association_proxy.rb
+++ b/activerecord/lib/active_record/associations/association_proxy.rb
@@ -253,9 +253,9 @@ module ActiveRecord
def load_target
return nil unless defined?(@loaded)
- if !loaded? and (!@owner.persisted? || foreign_key_present)
- if IdentityMap.enabled?
- @target = IdentityMap.get(@reflection.class_name, @owner[@reflection.association_foreign_key])
+ if !loaded? and (@owner.persisted? || foreign_key_present)
+ if IdentityMap.enabled? && defined?(@reflection.klass)
+ @target = IdentityMap.get(@reflection.klass, @owner[@reflection.association_foreign_key])
end
@target ||= find_target
end