diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2011-06-27 17:46:56 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-06-27 17:46:56 -0700 |
commit | 9152126110301730e4a5ff57100cdfb10fa9c9d3 (patch) | |
tree | 9efb5d2c0b7cc626a6b82aea21c8838ab3279d98 | |
parent | 45b7209f1f8b80f33ce104185f22c61503008dd3 (diff) | |
download | rails-9152126110301730e4a5ff57100cdfb10fa9c9d3.tar.gz rails-9152126110301730e4a5ff57100cdfb10fa9c9d3.tar.bz2 rails-9152126110301730e4a5ff57100cdfb10fa9c9d3.zip |
avoice paying hash cost if there are no serialized attributes
-rw-r--r-- | activerecord/lib/active_record/base.rb | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 79e8819387..ce7046760f 100644 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1893,9 +1893,10 @@ MSG private def set_serialized_attributes - (@attributes.keys & self.class.serialized_attributes.keys).each do |key| - coder = self.class.serialized_attributes[key] - @attributes[key] = coder.load @attributes[key] + sattrs = self.class.serialized_attributes + + sattrs.each do |key, coder| + @attributes[key] = coder.load @attributes[key] if @attributes.key?(key) end end |