aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Kubb <dan.kubb@gmail.com>2013-01-13 20:18:35 -0800
committerDan Kubb <dan.kubb@gmail.com>2013-01-13 20:27:33 -0800
commit688d52933a2e611175f3d41c016cf0ba71450b17 (patch)
tree8506834a0036902c8862a9b6ef9cccb2eb03512a
parent7c62a752db77af1aec57ccd4822e87cd6fd633b6 (diff)
downloadrails-688d52933a2e611175f3d41c016cf0ba71450b17.tar.gz
rails-688d52933a2e611175f3d41c016cf0ba71450b17.tar.bz2
rails-688d52933a2e611175f3d41c016cf0ba71450b17.zip
Fix DateTime comparison with DateTime::Infinity object
-rw-r--r--activesupport/CHANGELOG.md3
-rw-r--r--activesupport/lib/active_support/core_ext/date_time/calculations.rb2
2 files changed, 4 insertions, 1 deletions
diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md
index 18ca36ab06..0511a7ac2d 100644
--- a/activesupport/CHANGELOG.md
+++ b/activesupport/CHANGELOG.md
@@ -19,6 +19,9 @@
*Daniele Sluijters*
+* Fix DateTime comparison with DateTime::Infinity object.
+
+ *Dan Kubb*
## Rails 3.2.11 (Jan 8, 2012) ##
diff --git a/activesupport/lib/active_support/core_ext/date_time/calculations.rb b/activesupport/lib/active_support/core_ext/date_time/calculations.rb
index b759dcc824..0481bd2195 100644
--- a/activesupport/lib/active_support/core_ext/date_time/calculations.rb
+++ b/activesupport/lib/active_support/core_ext/date_time/calculations.rb
@@ -138,6 +138,6 @@ class DateTime
# Layers additional behavior on DateTime#<=> so that Time and ActiveSupport::TimeWithZone instances can be compared with a DateTime
def <=>(other)
- super other.to_datetime
+ super other.kind_of?(Infinity) ? other : other.to_datetime
end
end