codegram / date_validator

A simple, ORM agnostic, Ruby >=2.2 compatible date validator for Rails, based on ActiveModel.
http://thoughts.codegram.com/date-validation-with-rails-3
MIT License
496 stars 82 forks source link

Symbol and Proc values aren't handled correctly #1

Closed jrallison closed 14 years ago

jrallison commented 14 years ago

Ran into an issue with the following scenario:

validates :start_at, :date => { :after => Time.now, :before => :end_at }
validates :end_at, :date => { :after => Time.now }

If end_at happens to be nil, we get an exception "comparison of ActiveSupport::TimeWithZone with nil failed"

I've fixed in my fork: http://github.com/jrallison/date_validator/commit/2d8e609661a371d89dd41e6d99acbbe7a96f3fb1

txus commented 14 years ago

Hi John!

Thank you very much. Just send us a pull request and I update the code with your changes :)

Hope you enjoy the gem! ;)