diff options
author | kennyj <kennyj@gmail.com> | 2012-06-04 21:08:41 +0900 |
---|---|---|
committer | kennyj <kennyj@gmail.com> | 2012-06-04 21:12:44 +0900 |
commit | 510ef2be5396fb2cd8209b13e8b8ddac3f7e13a5 (patch) | |
tree | fbc40aa0ac82e16991d9e5d75814d9f9039a3835 /activerecord/lib/active_record/attribute_methods | |
parent | bebbdb5d4e27b2539b560cb3dafe84b1905636fc (diff) | |
download | rails-510ef2be5396fb2cd8209b13e8b8ddac3f7e13a5.tar.gz rails-510ef2be5396fb2cd8209b13e8b8ddac3f7e13a5.tar.bz2 rails-510ef2be5396fb2cd8209b13e8b8ddac3f7e13a5.zip |
Fix #6591. If a field with timezone isn't changed, we don't call will_change!.
Diffstat (limited to 'activerecord/lib/active_record/attribute_methods')
-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 c9b2edbd8c..7abe29c7d5 100644 --- a/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb +++ b/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb @@ -42,8 +42,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 |