Skip to content

Commit

Permalink
Do not add record to identity map if the record doesn't have values f…
Browse files Browse the repository at this point in the history
…or all the columns, so we don't get 'MissingAttributeError' later when trying to access other fields of the same record.
  • Loading branch information
arturopie committed Mar 28, 2012
1 parent 488ea89 commit a00a42d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion activerecord/lib/active_record/identity_map.rb
Expand Up @@ -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)
Expand Down

0 comments on commit a00a42d

Please sign in to comment.