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 using self.inherited removing filter_attributes & GeneratedAssociationMethods generated multiple times #50012

Merged
merged 1 commit into from
Nov 10, 2023

Conversation

Adrian-Hirt
Copy link
Contributor

This PR fixes issue #50003 where using super after adding relations to the subclass or defining filter attributes in the subclass in the method self.inherited lead to warnings and removed previously defined filter_attributes.

Motivation / Background

Fixes #50003.

Detail

I only added the ||= to @filter_attributes and @generated_association_methods, the other 3 variables in this code should not be affected. That way, only two additional OR operations are introduced.

Additional information

I added some tests as well, if the tests are run in an environment with strict warnings enabled it also verifies that the constant mentioned in #50003 is not redefined.

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one change. Changes that are unrelated should be opened in separate PRs.
  • Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
  • Tests are added or updated if you fix a bug or add a feature.
  • CHANGELOG files are updated for the changed libraries if there is a behavior change or additional feature. Minor bug fixes and documentation changes should not be included.

This commit fixes issue rails#50003 where using `super` after adding
relations to the subclass or defining filter attributes in the subclass
in the method `self.inherited` lead to warnings and removed
previously defined filter_attributes
@byroot
Copy link
Member

byroot commented Nov 10, 2023

Thank you!

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