aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/attribute_methods
diff options
context:
space:
mode:
authorSean Griffin <sean@seantheprogrammer.com>2015-09-24 15:16:06 -0600
committerSean Griffin <sean@seantheprogrammer.com>2015-09-24 15:16:06 -0600
commit20b177b78ef5d21c8cc255f0376f6b2e948de234 (patch)
tree08283c6556aa7545ce31cd1bd51bb8be0467eb63 /activerecord/lib/active_record/attribute_methods
parent370ef3e8bbafb5076737f9d9a79d83f70123a228 (diff)
downloadrails-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/active_record/attribute_methods')
-rw-r--r--activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb2
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