aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArturo Pie <arturotd08@yahoo.ca>2012-03-25 23:38:10 -0400
committerArturo Pie <arturotd08@yahoo.ca>2012-03-29 22:24:02 -0400
commit2c8f84d3a6b199b04394ed1a5bba3bc0d8f1e811 (patch)
tree2514d8dd59b8a2c56303292029a39d3e8a291202
parentb29e868cc335e2a696c36b6d7ccdf199ed8abf70 (diff)
downloadrails-2c8f84d3a6b199b04394ed1a5bba3bc0d8f1e811.tar.gz
rails-2c8f84d3a6b199b04394ed1a5bba3bc0d8f1e811.tar.bz2
rails-2c8f84d3a6b199b04394ed1a5bba3bc0d8f1e811.zip
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.
-rw-r--r--activerecord/lib/active_record/identity_map.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/identity_map.rb b/activerecord/lib/active_record/identity_map.rb
index 680d9ffea0..7ff755110f 100644
--- a/activerecord/lib/active_record/identity_map.rb
+++ b/activerecord/lib/active_record/identity_map.rb
@@ -90,7 +90,7 @@ module ActiveRecord
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)