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: warning instead raising error when can't find the inverse_of #1874

Merged
merged 2 commits into from
Jul 31, 2023

Conversation

Paul-Bob
Copy link
Contributor

Description

Fixes #1873

In order to render the detach button we check for the inverse association using the inverse_of method.

Occasionally, Rails may not identify the inverse association and we were raising an error to instruct where the inverse_of configuration is needed. We noticed that many apps was breaking due this error.

To improve user experience and avoid breaking apps, we have made a modification. Instead of raising an error, we now display a warning during development, providing guidance on the necessity of configuring inverse_of.

image

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works

@Paul-Bob Paul-Bob self-assigned this Jul 31, 2023
@github-actions github-actions bot added the Fix label Jul 31, 2023
@codeclimate
Copy link

codeclimate bot commented Jul 31, 2023

Code Climate has analyzed commit 4331e1b and detected 0 issues on this pull request.

View more on Code Climate.

@Paul-Bob Paul-Bob merged commit b31dcc5 into main Jul 31, 2023
13 checks passed
@Paul-Bob Paul-Bob deleted the fix/warning_instead_error_when_cant_find_inverse_of branch July 31, 2023 12:23
@github-actions
Copy link
Contributor

This PR has been merged into main. The functionality will be available in the next release.

Please check the release guide for more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Please configure the 'inverse_of' option for the 'has_many :xxxx' association on the 'zzzz' model.
2 participants