Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Admin visiting non-existent enterprise raises error #13224

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Tresor11
Copy link

What? Why?

Currently, when an admin tries to edit an no-existing enterprise, a NoMethodError is raised.

This commit adds a set_enterprise setter method to the enterprise controller that sets the @enterprise instance variable to have the same value as the enterprise object defined in the edit method; this method also rescues the NotFound error in case the enterprise is not found and redirects the user to the enterprise index page with an error message.

What should we test?

  • Login then visit /admin/enterprises/no-extisting/edit you should be redirected to the enterprises path with an error message
Screenshot 2025-03-22 at 01 05 53

Release notes

Changelog Category (reviewers may add a label for the release notes):

  • User facing changes

Currently when an admin tries to edit an no-existing enterprise, a
NoMethodError is raised.

This commit adds a set_enterprise setter method to the
enterprises controller that sets the @enterprise instance variable to
have the same value as the enterprise object defined in the the edit
method; this method also rescues the NotFound error  in case
the enterprise is not found and redirects the user to the enterprises
index page with a error message.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Code review 🔎
Development

Successfully merging this pull request may close these issues.

Admin visiting non-existent enterprise raises error
1 participant