This would allow you to validate that either a number or a Time based column sits between some lower bounds and some upper bounds.
Something like this
validate_between age, min: 30, max: 60
validate_between coupon, min: 2.days.ago, max: 2.days.from_now
We actually already have validate_numeric for validating that a number is within some range, so we could just make this for Time only, but I figure someone might reach for a number and wonder why it didn't work... We wouldn't get rid of validate_numeric though because with that you can set only a min or only a max and not care about the other bounds. With this you want to ensure that it's directly between the two.
This would allow you to validate that either a number or a Time based column sits between some lower bounds and some upper bounds.
Something like this
We actually already have
validate_numericfor validating that a number is within some range, so we could just make this forTimeonly, but I figure someone might reach for a number and wonder why it didn't work... We wouldn't get rid ofvalidate_numericthough because with that you can set only a min or only a max and not care about the other bounds. With this you want to ensure that it's directly between the two.