diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2015-02-13 03:04:47 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2015-02-20 10:25:31 +0900 |
commit | a088ee96918a938159cbeee1a3fe822f0bb46b5d (patch) | |
tree | 9b09d02933d2bc2cbed740e9daa1cc68ccad328a /activerecord/lib/active_record/connection_adapters | |
parent | 9ef870c0426f573355a10b04fd9740550492cd00 (diff) | |
download | rails-a088ee96918a938159cbeee1a3fe822f0bb46b5d.tar.gz rails-a088ee96918a938159cbeee1a3fe822f0bb46b5d.tar.bz2 rails-a088ee96918a938159cbeee1a3fe822f0bb46b5d.zip |
Format the time string according to the precision of the time column
It is also necessary to format a time column like a datetime column.
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb index c11f0c93b4..8db4bcd7e3 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb @@ -75,7 +75,7 @@ module ActiveRecord def prepare_column_options(column) spec = super - spec.delete(:precision) if column.type == :datetime && column.precision == 0 + spec.delete(:precision) if /time/ === column.sql_type && column.precision == 0 spec end @@ -733,7 +733,7 @@ module ActiveRecord end def extract_precision(sql_type) - if /datetime/ === sql_type + if /time/ === sql_type super || 0 else super |