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

Ticket #11111: less_connection_method_calls.patch

File less_connection_method_calls.patch, 1.2 kB (added by adymo, 8 months ago)
  • activerecord/lib/active_record/base.rb

    old new  
    24172417      # an SQL statement. 
    24182418      def attributes_with_quotes(include_primary_key = true, include_readonly_attributes = true) 
    24192419        quoted = {} 
     2420        connection = self.class.connection 
    24202421        @attributes.each_pair do |name, value| 
    24212422          if column = column_for_attribute(name) 
    2422             quoted[name] = quote_value(read_attribute(name), column) unless !include_primary_key && column.primary 
     2423            quoted[name] = connection.quote(read_attribute(name), column) unless !include_primary_key && column.primary 
    24232424          end 
    24242425        end 
    24252426        include_readonly_attributes ? quoted : remove_readonly_attributes(quoted) 
     
    25292530      end 
    25302531 
    25312532      def quoted_column_names(attributes = attributes_with_quotes) 
     2533        connection = self.class.connection 
    25322534        attributes.keys.collect do |column_name| 
    2533           self.class.connection.quote_column_name(column_name) 
     2535          connection.quote_column_name(column_name) 
    25342536        end 
    25352537      end 
    25362538