aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/type/date_time.rb
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2015-02-13 03:04:47 +0900
committerRyuta Kamizono <kamipo@gmail.com>2015-02-20 10:25:31 +0900
commita088ee96918a938159cbeee1a3fe822f0bb46b5d (patch)
tree9b09d02933d2bc2cbed740e9daa1cc68ccad328a /activerecord/lib/active_record/type/date_time.rb
parent9ef870c0426f573355a10b04fd9740550492cd00 (diff)
downloadrails-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/type/date_time.rb')
-rw-r--r--activerecord/lib/active_record/type/date_time.rb18
1 files changed, 0 insertions, 18 deletions
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)