diff options
author | Bogdan Gusiev <agresso@gmail.com> | 2015-09-22 12:48:50 +0300 |
---|---|---|
committer | Bogdan Gusiev <agresso@gmail.com> | 2015-09-23 13:29:08 +0300 |
commit | d03f5196657bf466d7576cd6cbd4886db030723b (patch) | |
tree | 29b1c6b120ebe89878905c0b112892d5300f6585 /activemodel/test/models/reply.rb | |
parent | 8842ce239562d3fbc82198ac3c4618935134ff39 (diff) | |
download | rails-d03f5196657bf466d7576cd6cbd4886db030723b.tar.gz rails-d03f5196657bf466d7576cd6cbd4886db030723b.tar.bz2 rails-d03f5196657bf466d7576cd6cbd4886db030723b.zip |
Fixed taking precision into count when assigning a value to timestamp attribute
Timestamp column can have less precision than ruby timestamp
In result in how big a fraction of a second can be stored in the
database.
m = Model.create!
m.created_at.usec == m.reload.created_at.usec
# => false
# due to different seconds precision in Time.now and database column
If the precision is low enough, (mysql default is 0, so it is always low
enough by default) the value changes when model is reloaded from the
database. This patch fixes that issue ensuring that any timestamp
assigned as an attribute is converted to column precision under the
attribute.
Diffstat (limited to 'activemodel/test/models/reply.rb')
0 files changed, 0 insertions, 0 deletions