From a088ee96918a938159cbeee1a3fe822f0bb46b5d Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Fri, 13 Feb 2015 03:04:47 +0900 Subject: 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. --- activerecord/lib/active_record/type/date_time.rb | 18 ------------------ 1 file changed, 18 deletions(-) (limited to 'activerecord/lib/active_record/type/date_time.rb') diff --git a/activerecord/lib/active_record/type/date_time.rb b/activerecord/lib/active_record/type/date_time.rb index 05d2af3808..a5199959b9 100644 --- a/activerecord/lib/active_record/type/date_time.rb +++ b/activerecord/lib/active_record/type/date_time.rb @@ -10,24 +10,6 @@ module ActiveRecord :datetime end - def serialize(value) - if precision && value.respond_to?(:usec) - number_of_insignificant_digits = 6 - precision - round_power = 10 ** number_of_insignificant_digits - value = value.change(usec: value.usec / round_power * round_power) - end - - if value.acts_like?(:time) - zone_conversion_method = ActiveRecord::Base.default_timezone == :utc ? :getutc : :getlocal - - if value.respond_to?(zone_conversion_method) - value = value.send(zone_conversion_method) - end - end - - value - end - private def cast_value(string) -- cgit v1.2.3