Skip to content

Add a uniqueness validation for Organization path

We need a new validation of path for Organizations::Organization.

Otherwise, users creating an organization where the path is already taken will get a 500 error (remember we don't show details of 500 errors to users). Screenshot_2023-10-30_at_3.54.43_PM

I expect to see a 200 response with a validation error that can be shown to the user.

/cc @alexpooley @peterhegman @lohrc

Implementation

Add a uniqueness validation in organization.rb model.

Also, try changing the organization.path unique index to use lower(path) like in routes index but with a unique index.

Edited by Abdul Wadood