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

Ticket #7034: use_db_format_to_quote_dates.diff

File use_db_format_to_quote_dates.diff, 1.0 kB (added by jeremymcanally, 2 years ago)
  • activerecord/lib/active_record/connection_adapters/abstract/quoting.rb

    old new  
    2424          when Float, Fixnum, Bignum    then value.to_s 
    2525          # BigDecimals need to be output in a non-normalized form and quoted. 
    2626          when BigDecimal               then value.to_s('F') 
    27           when Date                     then "'#{value.to_s}'" 
     27          when Date                     then "'#{value.to_formatted_s(:db)}'" 
    2828          when Time, DateTime           then "'#{quoted_date(value)}'" 
    2929          else                          "'#{quote_string(value.to_yaml)}'" 
    3030        end 
     
    5151      end 
    5252       
    5353      def quoted_date(value) 
    54         value.strftime("%Y-%m-%d %H:%M:%S"
     54        value.to_formatted_s(:db
    5555      end 
    5656    end 
    5757  end