From dd339bb0adc3bb1f0c376c4352f769ae2ab02b62 Mon Sep 17 00:00:00 2001 From: Andrew White Date: Sun, 26 Jan 2014 21:22:23 +0000 Subject: Make ActiveSupport::TimeWithZone#xmlschema consistent Both Time#xmlschema and DateTime#xmlschema can accept nil values for the fraction_digits parameter. This commit makes this so for TimeWithZone values as well. --- activesupport/lib/active_support/time_with_zone.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activesupport/lib/active_support/time_with_zone.rb') diff --git a/activesupport/lib/active_support/time_with_zone.rb b/activesupport/lib/active_support/time_with_zone.rb index 626438c9e4..d459af1778 100644 --- a/activesupport/lib/active_support/time_with_zone.rb +++ b/activesupport/lib/active_support/time_with_zone.rb @@ -132,8 +132,8 @@ module ActiveSupport end def xmlschema(fraction_digits = 0) - fraction = if fraction_digits > 0 - (".%06i" % time.usec)[0, fraction_digits + 1] + fraction = if fraction_digits.to_i > 0 + (".%06i" % time.usec)[0, fraction_digits.to_i + 1] end "#{time.strftime("%Y-%m-%dT%H:%M:%S")}#{fraction}#{formatted_offset(true, 'Z')}" -- cgit v1.2.3