Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 8858

Show
Ignore:
Timestamp:
02/11/08 21:02:17 (2 years ago)
Author:
nzkoz
Message:

Avoid cloning in Base#attributes_before_typecast. Closes #11077 [juanjo.bazan]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activerecord/lib/active_record/base.rb

    r8855 r8858  
    20892089      # left to the application to implement according to its need. 
    20902090      def clone 
    2091         attrs = self.attributes_before_type_cast 
     2091        attrs = clone_attributes(:read_attribute_before_type_cast) 
    20922092        attrs.delete(self.class.primary_key) 
    20932093        record = self.class.new 
     
    22372237      end 
    22382238 
    2239       # Returns a hash of cloned attributes before typecasting and deserialization. 
     2239      # Returns a hash of attributes before typecasting and deserialization. 
    22402240      def attributes_before_type_cast 
    2241         clone_attributes :read_attribute_before_type_cast 
     2241        attrs = {} 
     2242        self.attribute_names.each do |name| 
     2243          attrs[name]=read_attribute_before_type_cast(name) 
     2244        end 
     2245        attrs 
    22422246      end 
    22432247