Add error handling for vehicle and property account creation #1179
Reference in New Issue
Block a user
Delete Branch "fix-1178"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Close #1178
Could this be solved easier if we just apply client-side form validations?
I think we can add a
requiredattribute on these fields and let the browser do all of this for us.I'm in favor of this for these types of low-stakes validations.
@@ -37,2 +37,3 @@label: options[:label] || "Amount"label: options[:label] || "Amount",required: options[:required] || false}We'll need to update this improper usage for this to flow through correctly:
fd40111264/app/views/accounts/_form.html.erb (L8)See
required: "required"should be ->required: trueI think we can still remove all of these tests alongside the
rescuehandlers in the controller.The form validation should handle all the main requirements directly in the browser. If a user somehow finds a way to side-step these, I'd rather the system raise an error so that we can capture it in observability systems like Sentry (rather than the user seeing an error message and the system acting as if nothing went wrong).
Following this logic, I think our existing
createaction inaccounts_controllershould probably not have therescueblock either (as I'm sure that was the pattern you followed here). In other words, we could probably remove this as well:fd40111264/app/controllers/accounts_controller.rb (L61-L62)