diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-01-10 09:30:32 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-01-10 09:30:32 -0800 |
commit | bd1bf2c5b8480fae0379890347d58b9fe8231e3e (patch) | |
tree | af64fb69154a42c146615ab8ad855da95b04b67f /activesupport/lib/active_support/core_ext | |
parent | 35cc32841ed343e3013cdf67e7330647d50d668b (diff) | |
parent | 2af5303683f729bb1a4eb582a023276b8a0db402 (diff) | |
download | rails-bd1bf2c5b8480fae0379890347d58b9fe8231e3e.tar.gz rails-bd1bf2c5b8480fae0379890347d58b9fe8231e3e.tar.bz2 rails-bd1bf2c5b8480fae0379890347d58b9fe8231e3e.zip |
Merge branch 'ruby-2.2'
* ruby-2.2:
Check `respond_to` before delegation due to: https://github.com/ruby/ruby/commit/d781caaf313b8649948c107bba277e5ad7307314
Diffstat (limited to 'activesupport/lib/active_support/core_ext')
-rw-r--r-- | activesupport/lib/active_support/core_ext/date_time/calculations.rb | 6 |
1 files changed, 5 insertions, 1 deletions
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 8e5d723074..73ad0aa097 100644 --- a/activesupport/lib/active_support/core_ext/date_time/calculations.rb +++ b/activesupport/lib/active_support/core_ext/date_time/calculations.rb @@ -151,7 +151,11 @@ 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 + if other.respond_to? :to_datetime + super other.to_datetime + else + nil + end end end |