diff options
-rw-r--r-- | activerecord/lib/active_record/identity_map.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/identity_map.rb b/activerecord/lib/active_record/identity_map.rb index 47ba3acf32..70ea08ee43 100644 --- a/activerecord/lib/active_record/identity_map.rb +++ b/activerecord/lib/active_record/identity_map.rb @@ -42,7 +42,8 @@ module ActiveRecord end def get(klass, primary_key) - repository[klass.symbolized_base_class][primary_key] + obj = repository[klass.symbolized_base_class][primary_key] + obj.is_a?(klass) ? obj : nil end def add(record) |