diff options
author | Andrew White <andrew.white@unboxed.co> | 2018-03-11 18:23:50 +0000 |
---|---|---|
committer | Andrew White <andrew.white@unboxed.co> | 2018-03-11 18:30:07 +0000 |
commit | 3f95054f1c5ffe9e9b3bccdabc1ab1a7a4beb24a (patch) | |
tree | 1f49fca9a8751ce76b864ae7173eea4e8e3896b7 /guides/source | |
parent | 4d9126cfccefdb69149caf7681d674b50335e9b4 (diff) | |
download | rails-3f95054f1c5ffe9e9b3bccdabc1ab1a7a4beb24a.tar.gz rails-3f95054f1c5ffe9e9b3bccdabc1ab1a7a4beb24a.tar.bz2 rails-3f95054f1c5ffe9e9b3bccdabc1ab1a7a4beb24a.zip |
Normalize date component when writing to time columns
For legacy reasons Rails stores time columns on sqlite as full
timestamp strings. However because the date component wasn't being
normalized this meant that when they were read back they were being
prefixed with 2001-01-01 by ActiveModel::Type::Time. This had a
twofold result - first it meant that the fast code path wasn't being
used because the string was invalid and second it was corrupting the
second fractional component being read by the Date._parse code path.
Fix this by a combination of normalizing the timestamps on writing
and also changing Active Model to be more lenient when detecting
whether a string starts with a date component before creating the
dummy time value for parsing.
Diffstat (limited to 'guides/source')
0 files changed, 0 insertions, 0 deletions