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
My bad! I was messing around with parameter coercion substitution that I want to treat blank as infinite. This fragment indeed does work! However, there is another problem. It doesn't respect DateTime::Infinity that was coming from my strong params filter. I forgot I added
Activity
dgmstuart commentedon Mar 16, 2016
Yup - I've been bitten by that one. The solution is to use
So the date validation won't get run if date is not present.
mlt commentedon Sep 25, 2017
I have something like
It complains if effective_to is blank :(
["Effective to is not a date"]dgmstuart commentedon Sep 25, 2017
@mlt Here's a section of code involved, which suggests that your code above should work:
date_validator/lib/active_model/validations/date_validator.rb
Lines 52 to 71 in 0a1f7ae
A
blankstring can be many things: nil, empty string, string containing only whitespace, false - which is it in your scenario?mlt commentedon Sep 26, 2017
My bad! I was messing around with parameter
coercionsubstitution that I want to treat blank as infinite. This fragment indeed does work! However, there is another problem. It doesn't respectDateTime::Infinitythat was coming from my strong params filter. I forgot I addedNote, that
worked fine with blank (actually infinite) parameter. It seems to me they should be equivalent.