diff options
author | Geoff Buesing <gbuesing@gmail.com> | 2010-01-27 20:16:08 -0600 |
---|---|---|
committer | Geoff Buesing <gbuesing@gmail.com> | 2010-01-27 20:17:09 -0600 |
commit | e98f9579c472e75f5a8c0678f2fc54b2d681e3ec (patch) | |
tree | b086a8cb78daa5f703fcf2597b466d081e77da03 /activesupport/lib/active_support | |
parent | 016f15dc69b876c62606d267dcbb8124d0ad02a5 (diff) | |
download | rails-e98f9579c472e75f5a8c0678f2fc54b2d681e3ec.tar.gz rails-e98f9579c472e75f5a8c0678f2fc54b2d681e3ec.tar.bz2 rails-e98f9579c472e75f5a8c0678f2fc54b2d681e3ec.zip |
Time#- with a DateTime argument behaves the same as with a Time argument, i.e. returns the difference between self and arg as a Float [#3476 status:resolved]
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/core_ext/time/calculations.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/time/calculations.rb b/activesupport/lib/active_support/core_ext/time/calculations.rb index 703b89ffd0..98906bc5c0 100644 --- a/activesupport/lib/active_support/core_ext/time/calculations.rb +++ b/activesupport/lib/active_support/core_ext/time/calculations.rb @@ -259,7 +259,7 @@ class Time # are coerced into values that Time#- will recognize def minus_with_coercion(other) other = other.comparable_time if other.respond_to?(:comparable_time) - minus_without_coercion(other) + other.is_a?(DateTime) ? to_f - other.to_f : minus_without_coercion(other) end alias_method :minus_without_coercion, :- alias_method :-, :minus_with_coercion |