I’m trying to validate 2 dates that were provided by the user using a form that wraps a model.
I want to do the following 2 validations in the model:
**** validate the date format => That I know how to do!
**** if the format validation was a success, then ensure that date1 is smaller or equal than date2 => That’s I do not know
I’ve spend, in vain, more than 2 hours to find a solution in order to understand:
** 1 ** How to trigger a second validation only if the first one was an success?
** 2 ** How to compare to dates using the macros in ActiveRecord?