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

Changeset 8770

Show
Ignore:
Timestamp:
02/01/08 23:15:57 (1 year ago)
Author:
nzkoz
Message:

Avoid Base#attributes when saving / creating records. Closes #10978 [adymo]

Files:

Legend:

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

    r8672 r8770  
    24272427      # an SQL statement. 
    24282428      def attributes_with_quotes(include_primary_key = true, include_readonly_attributes = true) 
    2429         quoted = attributes.inject({}) do |result, (name, value)| 
     2429        quoted = {} 
     2430        @attributes.each_pair do |name, value| 
    24302431          if column = column_for_attribute(name) 
    2431             result[name] = quote_value(value, column) unless !include_primary_key && column.primary 
    2432           end 
    2433           result 
     2432            quoted[name] = quote_value(read_attribute(name), column) unless !include_primary_key && column.primary 
     2433          end 
    24342434        end 
    24352435        include_readonly_attributes ? quoted : remove_readonly_attributes(quoted)