Closed haikalhussein closed 8 years ago
If I understand you correctly you probably want something like this
validate_datetime :some_attribute, on_or_after: proc {|r| 20.minutes.since(r.other_attribute) },
on_or_before: proc {|r| 48.hours.since(r.other_attribute) }
Which depends on other_attribute
being present of course. Is that what you are looking for?
Sorry my bad. But my data type in psql is interval. Can the gem validates for column type interval, where it can store data like "48:00:00". Because currently the timespan does not require any specific end points.
no doesn't support intervals. I imagine you just validate intervals as a value object. I've not handled intervals in Rails, just directly in sql.
I'm using rails 4 and the gem works. But now i got a situation whereby a user's time is between 20 minutes to 48 hours. Is it possible to validate ?