diff options
author | Arturo Pie <arturotd08@yahoo.ca> | 2012-03-26 22:45:48 -0400 |
---|---|---|
committer | Arturo Pie <arturotd08@yahoo.ca> | 2012-03-29 22:24:15 -0400 |
commit | 714a2c810deb9d219442f7c981e61eb6d5c45d33 (patch) | |
tree | ea9da2e56283d4c79bfc58d2c2edf8e8a757c529 /activerecord/lib/active_record | |
parent | 2c8f84d3a6b199b04394ed1a5bba3bc0d8f1e811 (diff) | |
download | rails-714a2c810deb9d219442f7c981e61eb6d5c45d33.tar.gz rails-714a2c810deb9d219442f7c981e61eb6d5c45d33.tar.bz2 rails-714a2c810deb9d219442f7c981e61eb6d5c45d33.zip |
refactor the checking of the attributes of the record in IdentityMap#add, so it's more readable
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/identity_map.rb | 8 |
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+. |