Skip to content

Conversation

@m-kind
Copy link

@m-kind m-kind commented Apr 7, 2018

Comparison of a Time or DateTime value with nil raises an error:

2.3.1 :004 > DateTime.now == nil
NoMethodError: undefined method `to_datetime' for nil:NilClass

I simply turned this into a guard clause (writing it like nil == time would have worked, too).

Comparison of a DateTime value with nil raises 

```
NoMethodError: undefined method `to_datetime' for nil:NilClass
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant