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

Ticket #8159: dont_spuriously_throw_exceptions_in_attribute_value_clone.diff

File dont_spuriously_throw_exceptions_in_attribute_value_clone.diff, 0.6 kB (added by blaine, 1 year ago)
  • activerecord/lib/active_record/base.rb

    old new  
    22312231 
    22322232      def clone_attribute_value(reader_method, attribute_name) 
    22332233        value = send(reader_method, attribute_name) 
    2234         value.clone 
     2234        case value 
     2235        when nil, Fixnum, true, false: value 
     2236        else 
     2237          value.clone 
     2238        end 
    22352239      rescue TypeError, NoMethodError 
    22362240        value 
    22372241      end