diff options
author | kennyj <kennyj@gmail.com> | 2012-06-04 03:12:21 +0900 |
---|---|---|
committer | kennyj <kennyj@gmail.com> | 2012-06-04 18:35:08 +0900 |
commit | 635032fe3ba3d189e9c62eadb6e604f22669414d (patch) | |
tree | 26c5a95e9ba7ec2eeb804e34a5a9ab4ab9994c60 /activerecord/lib | |
parent | cfc7f602bfab90d78828f50961dbaa1daf64a352 (diff) | |
download | rails-635032fe3ba3d189e9c62eadb6e604f22669414d.tar.gz rails-635032fe3ba3d189e9c62eadb6e604f22669414d.tar.bz2 rails-635032fe3ba3d189e9c62eadb6e604f22669414d.zip |
Fix #6591. If a field with timezone isn't changed, we don't call will_change!.
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb | 3 |
1 files changed, 2 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 ac31b636db..58a5d82e14 100644 --- a/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb +++ b/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb @@ -57,8 +57,9 @@ module ActiveRecord time = time.is_a?(String) ? Time.zone.parse(time) : time.to_time rescue time end time = time.in_time_zone rescue nil if time + changed = read_attribute(:#{attr_name}) != time write_attribute(:#{attr_name}, original_time) - #{attr_name}_will_change! + #{attr_name}_will_change! if changed @attributes_cache["#{attr_name}"] = time end EOV |