rails/rails — pull request #10595 by Soylent (2013-05-13 11:54:06+00:00)
Title: Extended method DateTime#<=> can accept nil

Bug: extended method DateTime#<=> does not accept nil

This causes the following problem:

```
% rails console
irb(main):001:0> (Time.now..Time.now).cover? nil
NoMethodError: undefined method `to_datetime' for nil:NilClass
from /Users/Soilent/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/bundler/gems/rails-b44f086cf105/activesupport/lib/active_support/core_ext/date_time/calculations.rb:162:in `<=>'
from /Users/Soilent/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/bundler/gems/rails-b44f086cf105/activesupport/lib/active_support/core_ext/time/calculations.rb:269:in `compare_with_coercion'
from (irb):1:in `cover?'
from (irb):1
from /Users/Soilent/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/bundler/gems/rails-b44f086cf105/railties/lib/rails/commands/console.rb:90:in `start'
from /Users/Soilent/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/bundler/gems/rails-b44f086cf105/railties/lib/rails/commands/console.rb:9:in `start'
from /Users/Soilent/.rbenv/versions/2.0.0-p0/lib/ruby/gems/2.0.0/bundler/gems/rails-b44f086cf105/railties/lib/rails/commands.rb:66:in `'
from bin/rails:4:in `require'
from bin/rails:4:in `

'
```

Original method DateTime#<=> accepts nil, and this problem does not happen:
```
% irb
irb(main):001:0> require 'date'
=> true
irb(main):002:0> (Time.now..Time.now).cover? nil
=> false
irb(main):003:0> DateTime.new <=> nil
=> nil
```