Permalink
Browse files

avoice paying hash cost if there are no serialized attributes

  • Loading branch information...
1 parent 45b7209 commit 9152126110301730e4a5ff57100cdfb10fa9c9d3 @tenderlove tenderlove committed Jun 28, 2011
Showing with 4 additions and 3 deletions.
  1. +4 −3 activerecord/lib/active_record/base.rb
@@ -1893,9 +1893,10 @@ def clone_attribute_value(reader_method, attribute_name)
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

0 comments on commit 9152126

Please sign in to comment.