Skip to content
Browse files

Fix #6591. If a field with timezone isn't changed, we don't call will…

…_change!.
  • Loading branch information...
1 parent cfc7f60 commit 635032fe3ba3d189e9c62eadb6e604f22669414d @kennyj kennyj committed
Showing with 2 additions and 1 deletion.
  1. +2 −1 activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb
View
3 activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb
@@ -57,8 +57,9 @@ def #{attr_name}=(original_time)
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

0 comments on commit 635032f

Please sign in to comment.
Something went wrong with that request. Please try again.