From 484253515c0e05760541dc48946361185c9e6904 Mon Sep 17 00:00:00 2001 From: Neer Friedman Date: Sun, 7 Jul 2013 17:38:09 +0300 Subject: Fix microsecond precision of Time#at_with_coercion When Time.at_with_coercion (wraps Time.at) is called with a single argument that "acts_like?(:time)" it is coerced to integer thus losing it's microsecond percision. This commits changes this to use `#to_f` to prevent the problem --- activesupport/lib/active_support/core_ext/time/calculations.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activesupport/lib') diff --git a/activesupport/lib/active_support/core_ext/time/calculations.rb b/activesupport/lib/active_support/core_ext/time/calculations.rb index fa74fee78a..8270093dc7 100644 --- a/activesupport/lib/active_support/core_ext/time/calculations.rb +++ b/activesupport/lib/active_support/core_ext/time/calculations.rb @@ -34,7 +34,7 @@ class Time # instances can be used when called with a single argument def at_with_coercion(*args) if args.size == 1 && args.first.acts_like?(:time) - at_without_coercion(args.first.to_i) + at_without_coercion(args.first.to_f) else at_without_coercion(*args) end -- cgit v1.2.3