From 42418cfc94d1356d35d28d786f63e7fab9406ad6 Mon Sep 17 00:00:00 2001 From: Sean Griffin Date: Mon, 8 Dec 2014 14:49:46 -0700 Subject: Allow custom handling of non-standard types in `time_zone_conversion` PostgreSQL for example, allows infinity as a valid value for date time columns. The PG type has explicit handling for that case. However, time zone conversion will end up trampling that handling. Unfortunately, we can't call super and then convert time zones. However, if we get back nil from `.in_time_zone`, it's something we didn't expect so we can let the superclass handle it. Fixes #17971 --- .../lib/active_record/attribute_methods/time_zone_conversion.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib/active_record') 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 33d9d2002c..87274dd4e1 100644 --- a/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb +++ b/activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb @@ -12,7 +12,7 @@ module ActiveRecord if value.is_a?(Array) value.map { |v| type_cast_from_user(v) } elsif value.respond_to?(:in_time_zone) - value.in_time_zone + value.in_time_zone || super end end -- cgit v1.2.3