Browse files

Do not add record to identity map if the record doesn't have values f…

…or all the columns, so we don't get 'MissingAttributeError' later when trying to access other fields of the same record.
  • Loading branch information...
1 parent 488ea89 commit a00a42dc013602c74fc6aca89fc9a69fe29c05b5 @arturopie arturopie committed Mar 26, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 activerecord/lib/active_record/identity_map.rb
View
2 activerecord/lib/active_record/identity_map.rb
@@ -90,7 +90,7 @@ def get(klass, primary_key)
end
def add(record)
- repository[record.class.symbolized_sti_name][record.id] = record
+ repository[record.class.symbolized_sti_name][record.id] = record if record.class.column_names - record.attribute_names == []
end
def remove(record)

0 comments on commit a00a42d

Please sign in to comment.