mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Apply subsecond precision on assignment when using TZ aware attributes
When a time object was assigned to a datetime column, the decorator for
TZ aware attributes wouldn't call super, so when using a database
without support for subsecond precision, the nanosecond would not be
truncated, leading to the value being marked as changed.
Interestingly, this also shows our new implementation of dirty checking
to be more robust than the old one (with less code and better
performance! 🎉!!!)
This commit is contained in:
parent
370ef3e8bb
commit
20b177b78e
1 changed files with 1 additions and 1 deletions
|
@ -13,7 +13,7 @@ module ActiveRecord
|
|||
set_time_zone_without_conversion(super)
|
||||
elsif value.respond_to?(:in_time_zone)
|
||||
begin
|
||||
user_input_in_time_zone(value) || super
|
||||
super(user_input_in_time_zone(value)) || super
|
||||
rescue ArgumentError
|
||||
nil
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue