diff options
-rw-r--r-- | activerecord/lib/active_record/associations/association_proxy.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/association_proxy.rb b/activerecord/lib/active_record/associations/association_proxy.rb index 52cb164550..cb8d8b4a7b 100644 --- a/activerecord/lib/active_record/associations/association_proxy.rb +++ b/activerecord/lib/active_record/associations/association_proxy.rb @@ -254,7 +254,7 @@ module ActiveRecord return nil unless defined?(@loaded) if !loaded? and (@owner.persisted? || foreign_key_present) - if IdentityMap.enabled? && defined?(@reflection.klass) + if IdentityMap.enabled? && ActiveRecord.const_defined?(@reflection.class_name) @target = IdentityMap.get(@reflection.klass, @owner[@reflection.association_foreign_key]) end @target ||= find_target |