Hello,
I have this validation code in my model.
def validate errors.add(:last_action_date, "some message") if next_action_date < last_action_date end
Two date select fields.
Without the code, as long as dates are valid (no 31st of February), no errors, works ok.
With the code in place, when the next_action_date is before the last_action_date then I get a NoMethodError
You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil.inject
The validation seems to work, but instead of stopping the code and going back into edit mode like all other rails validations, instead it gives an error.
Can anyone point me in the right direction?
Thank you,
GPB