aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/identity_map.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/identity_map.rb')
-rw-r--r--activerecord/lib/active_record/identity_map.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/identity_map.rb b/activerecord/lib/active_record/identity_map.rb
index 7ff755110f..f3891b406e 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 if record.class.column_names - record.attribute_names == []
+ repository[record.class.symbolized_sti_name][record.id] = record if contain_all_columns(record)
end
def remove(record)
@@ -104,6 +104,12 @@ module ActiveRecord
def clear
repository.clear
end
+
+ private
+
+ def contain_all_columns(record)
+ (record.class.column_names - record.attribute_names) == []
+ end
end
# Reinitialize an Identity Map model object from +coder+.