Skip to content

Commit a00a42d

Browse files
committed
Do not add record to identity map if the record doesn't have values for all the columns, so we don't get 'MissingAttributeError' later when trying to access other fields of the same record.
1 parent 488ea89 commit a00a42d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

activerecord/lib/active_record/identity_map.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def get(klass, primary_key)
9090
end
9191

9292
def add(record)
93-
repository[record.class.symbolized_sti_name][record.id] = record
93+
repository[record.class.symbolized_sti_name][record.id] = record if record.class.column_names - record.attribute_names == []
9494
end
9595

9696
def remove(record)

0 commit comments

Comments
 (0)