You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sorry, I couldn't apply your pull request because it breaks a spec (the one checking the :after_or_equal_to clause).
Turns out that somehow comparing two equal datetimes or times with >= (but not with <=) returns false. I've been researching but the best solution I found a couple days ago was to convert them to integer before comparing them; now I've fixed that Date thing converting all TimeWithZones and Dates to datetime before the to_i, so there should be no problem now.
Let me know if you find out about that datetime comparison strange issue, maybe it's my ruby version or I don't know! And thank you for contributing ;)
But there is small issue in your fix, too. It is when you do value = value.to_datetime and then pass record.errors.add(... :value => value ...). The original value is a Date, but the one is passed to i18n error message is an Datetime(becouse you convert the value directly). This couse a small issue with formatting in error messages.
I think it is better to introduce a new variable for comparison, but pass the original one to i18n error.
Yep! fixed. However I'm thinking this actually means that the i18n part is not covered by tests, so I think maybe tomorrow I'm giving it a try and get it covered to avoid future bugs!
Raises "undefined method `to_i' for ... :Date" when valildatable value is a Date
rails 3 beta4
The text was updated successfully, but these errors were encountered: