Cleanup: fix logic surrounding case contacts with no reimbursements
Closed this issue · 0 comments
Had an issue where users could not create case contacts. This PR was a bit of a hasty fix.
Causes
The issue was when an org has neither driving reimbursement nor additional expenses no parameters would be submitted on /case_contacts/:id/form/expense
.
This meant that params
would not contain case_contact
and params[:case_contact][:status] = step.to_s unless @case_contact.active?
would fail or later with params.require(:case_contact).permit(...)
Temp Fix
The temporary fix was to add <%= form.hidden_field :placeholder, value: true %>
to ensure something is always submitted.
This is a terrible hacky fix.
Goals
We should find a better fix on both the system and request sides. From a user perspective it probably does not make sense that page is ever shown if a user can't do anything on it. Maybe it should not be shown?
On the other hand that might add a lot of complexity and instead we should be able to gracefully recover if a request is sent with no in the params case_contact
.
I am not sure what the ideal solution is but both paths are probably worth exploring.