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

Ticket #8049: quoting.diff

File quoting.diff, 1.7 kB (added by FooBarWidget, 1 year ago)

Changes to the Quoting module

  • activerecord/lib/active_record/connection_adapters/abstract/quoting.rb

    old new  
    1111          when String, ActiveSupport::Multibyte::Chars 
    1212            value = value.to_s 
    1313            if column && column.type == :binary && column.class.respond_to?(:string_to_binary) 
    14               "'#{quote_string(column.class.string_to_binary(value))}'" # ' (for ruby-mode) 
     14              "#{quoted_string_prefix}'#{quote_string(column.class.string_to_binary(value))}'" # ' (for ruby-mode) 
    1515            elsif column && [:integer, :float].include?(column.type) 
    1616              value = column.type == :integer ? value.to_i : value.to_f 
    1717              value.to_s 
    1818            else 
    19               "'#{quote_string(value)}'" # ' (for ruby-mode) 
     19              "#{quoted_string_prefix}'#{quote_string(value)}'" # ' (for ruby-mode) 
    2020            end 
    2121          when NilClass                 then "NULL" 
    2222          when TrueClass                then (column && column.type == :integer ? '1' : quoted_true) 
     
    2828            if value.acts_like?(:date) || value.acts_like?(:time) 
    2929              "'#{quoted_date(value)}'" 
    3030            else 
    31               "'#{quote_string(value.to_yaml)}'" 
     31              "#{quoted_string_prefix}'#{quote_string(value.to_yaml)}'" 
    3232            end 
    3333        end 
    3434      end 
     
    5656      def quoted_date(value) 
    5757        value.to_s(:db) 
    5858      end 
     59 
     60      def quoted_string_prefix 
     61        '' 
     62      end 
    5963    end 
    6064  end 
    6165end