Browse files

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

…_change!.
  • Loading branch information...
1 parent bebbdb5 commit 510ef2be5396fb2cd8209b13e8b8ddac3f7e13a5 @kennyj kennyj committed Jun 4, 2012
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
@@ -42,8 +42,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 510ef2b

Please sign in to comment.