Conditional Validation in Rails
Wednesday, July 4th, 2007
I was implementing the Strategy pattern presented here to avoid the limitations of Single-Type Inheritance but I wanted to implement some conditional validations based on the type:
If it’s a “MonthDay-based” recurring event (e.g. 23rd of every month), then the monthday field must be present
If it’s a “Date-based” recurring event (e.g. 1st August, repeating every year), [...]