Closed ElisaRmz closed 4 weeks ago
@ElisaRmz I saw something like the requested changes recently in the CaseContact model:
validates :occurred_at, presence: true
validates :occurred_at, comparison: {
greater_than_or_equal_to: MINIMUM_DATE,
message: "can't be prior to #{I18n.l(MINIMUM_DATE)}.",
allow_nil: true
}
validates :occurred_at, comparison: {
less_than: Date.tomorrow,
message: :cant_be_future,
allow_nil: true
}
The allow_nil
is the key part! Hope that helps!
I applied the changes suggested in the review.
Let me know if it's what you expected :)
@elasticspoon @thejonroberts
What github issue is this PR for, if any?
Resolves #5921
What changed, and why?
The issue involved multiple error messages when creating a Casa case with a blank court date and/or a blank birth month year youth.
I have modified the validations in casa_case model. With this partial only one error message is shown per field in the form.
How is this tested? (please write tests!) 💖💪
Note: if you see a flake in your test build in github actions, please post in slack #casa "Flaky test: " :) 💪 Note: We love capybara tests! If you are writing both haml/js and ruby, please try to test your work with tests at every level including system tests like https://github.com/rubyforgood/casa/tree/main/spec/system
Screenshots please :)
Replicating the previous steps in the issue:
Feelings gif (optional)
What gif best describes your feeling working on this issue? https://giphy.com/ How to embed:
![alt text](https://media.giphy.com/media/1nP7ThJFes5pgXKUNf/giphy.gif)