diff options
author | Sean Griffin <sean@seantheprogrammer.com> | 2015-09-24 15:16:06 -0600 |
---|---|---|
committer | Sean Griffin <sean@seantheprogrammer.com> | 2015-09-24 15:16:06 -0600 |
commit | 20b177b78ef5d21c8cc255f0376f6b2e948de234 (patch) | |
tree | 08283c6556aa7545ce31cd1bd51bb8be0467eb63 /activerecord/lib | |
parent | 370ef3e8bbafb5076737f9d9a79d83f70123a228 (diff) | |
download | rails-20b177b78ef5d21c8cc255f0376f6b2e948de234.tar.gz rails-20b177b78ef5d21c8cc255f0376f6b2e948de234.tar.bz2 rails-20b177b78ef5d21c8cc255f0376f6b2e948de234.zip |
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! :tada:!!!)
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb b/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb index f9beb43e4b..9e693b6aee 100644 --- a/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb +++ b/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb @@ -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 |