diff options
author | Tatsuhiko Miyagawa <miyagawa@bulknews.net> | 2012-11-12 13:48:50 -0800 |
---|---|---|
committer | Arthur Neves <arthurnn@gmail.com> | 2014-03-12 09:02:20 -0400 |
commit | df5a38fc6aeb8dfaa816fcbe0efb3fe4de169833 (patch) | |
tree | c27cb3caead4843d6eaacb097ff9e5f1457ff20c /activerecord | |
parent | 7e21be3c29fc8b4a8edbf93b9cc06b9e9186bb4a (diff) | |
download | rails-df5a38fc6aeb8dfaa816fcbe0efb3fe4de169833.tar.gz rails-df5a38fc6aeb8dfaa816fcbe0efb3fe4de169833.tar.bz2 rails-df5a38fc6aeb8dfaa816fcbe0efb3fe4de169833.zip |
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.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/mysql2_adapter.rb | 8 |
1 files changed, 8 insertions, 0 deletions
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? |