diff options
author | Sam Stephenson <sam@37signals.com> | 2007-01-15 22:02:11 +0000 |
---|---|---|
committer | Sam Stephenson <sam@37signals.com> | 2007-01-15 22:02:11 +0000 |
commit | 312e6edf914a8b561feacac2486d97e7904472e5 (patch) | |
tree | aa7f808afc3726c3170b269ef60c18f1e1e0c77f /activesupport/lib/active_support/core_ext/date | |
parent | 521ca37c3e6c453f48ab1dd9225bde6ea3a0c9d6 (diff) | |
download | rails-312e6edf914a8b561feacac2486d97e7904472e5.tar.gz rails-312e6edf914a8b561feacac2486d97e7904472e5.tar.bz2 rails-312e6edf914a8b561feacac2486d97e7904472e5.zip |
Fix that Dates couldn't be subtracted from Dates after [5940].
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5954 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/lib/active_support/core_ext/date')
-rw-r--r-- | activesupport/lib/active_support/core_ext/date/calculations.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/date/calculations.rb b/activesupport/lib/active_support/core_ext/date/calculations.rb index f81cd9187e..b104e5271a 100644 --- a/activesupport/lib/active_support/core_ext/date/calculations.rb +++ b/activesupport/lib/active_support/core_ext/date/calculations.rb @@ -23,7 +23,11 @@ module ActiveSupport #:nodoc: end def minus_with_duration(other) #:nodoc: - self.plus_with_duration(-other) + if ActiveSupport::Duration === other + plus_with_duration(-other) + else + minus_without_duration(other) + end end # Provides precise Date calculations for years, months, and days. The +options+ parameter takes a hash with |