diff options
author | Emilio Tagua <miloops@gmail.com> | 2010-10-14 15:09:44 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2010-11-19 19:08:42 -0300 |
commit | 96cc08f24b0d1576573e09500faa4a9fd106f44e (patch) | |
tree | a07b794a04da83acc2f0a8e76e9d68d500d6f85b /activerecord/lib/active_record/associations/association_proxy.rb | |
parent | 0873d1e944147b0f4b15e742fa9df0776a024d51 (diff) | |
download | rails-96cc08f24b0d1576573e09500faa4a9fd106f44e.tar.gz rails-96cc08f24b0d1576573e09500faa4a9fd106f44e.tar.bz2 rails-96cc08f24b0d1576573e09500faa4a9fd106f44e.zip |
Check if constant is defined in AR, if not this can cause errors when using polymorphic associations.
Diffstat (limited to 'activerecord/lib/active_record/associations/association_proxy.rb')
-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 |