Let validates_inclusion_of accept Time and DateTime ranges

```ruby
validates_inclusion_of :crated_at, 1.year.ago..Time.now
```
raises

    TypeError: can't iterate from Time

since #10774 was merged.
This PR fixes the regression.

I think we'd better backport this to 4-0-stable before shipping 4.0.1 stable release.