From df5a38fc6aeb8dfaa816fcbe0efb3fe4de169833 Mon Sep 17 00:00:00 2001 From: Tatsuhiko Miyagawa Date: Mon, 12 Nov 2012 13:48:50 -0800 Subject: MySQL 5.6 and later supports microsecond precision in datetime. You might want to branch it to include this only for 5.6, but passing these values to < 5.6 doesn't cause issues either. --- .../lib/active_record/connection_adapters/mysql2_adapter.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb b/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb index b07b0cb826..2b5049f5a5 100644 --- a/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb @@ -83,6 +83,14 @@ module ActiveRecord @connection.escape(string) end + def quoted_date(value) + if value.acts_like?(:time) && value.respond_to?(:usec) + "#{super}.#{sprintf("%06d", value.usec)}" + else + super + end + end + # CONNECTION MANAGEMENT ==================================== def active? -- cgit v1.2.3