-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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 #51720] Infer association klass as top level if model has same demodularized name #51721
Merged
rafaelfranca
merged 1 commit into
rails:main
from
joshuay03:fix-same-association-name-as-demodularized-model-name
May 22, 2024
Merged
[Fix #51720] Infer association klass as top level if model has same demodularized name #51721
rafaelfranca
merged 1 commit into
rails:main
from
joshuay03:fix-same-association-name-as-demodularized-model-name
May 22, 2024
+53
−2
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
joshuay03
force-pushed
the
fix-same-association-name-as-demodularized-model-name
branch
from
May 3, 2024 03:31
2ce81b0
to
fc52884
Compare
joshuay03
commented
May 3, 2024
Admin::User | ||
) | ||
|
||
assert_equal User, reflection.klass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
joshuay03
force-pushed
the
fix-same-association-name-as-demodularized-model-name
branch
from
May 3, 2024 03:44
fc52884
to
b27ccdb
Compare
joshuay03
commented
May 3, 2024
Admin::User | ||
) | ||
|
||
assert_equal Nested::User, reflection.klass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this to make sure we don't regress on this case.
joshuay03
force-pushed
the
fix-same-association-name-as-demodularized-model-name
branch
from
May 3, 2024 03:56
b27ccdb
to
fabbe59
Compare
joshuay03
force-pushed
the
fix-same-association-name-as-demodularized-model-name
branch
2 times, most recently
from
May 5, 2024 09:06
45b45e0
to
f48afa8
Compare
…ame demodularized name
joshuay03
force-pushed
the
fix-same-association-name-as-demodularized-model-name
branch
from
May 22, 2024 23:05
f48afa8
to
0516eaf
Compare
rafaelfranca
added a commit
that referenced
this pull request
May 22, 2024
…-demodularized-model-name [Fix #51720] Infer association klass as top level if model has same demodularized name
joshuay03
deleted the
fix-same-association-name-as-demodularized-model-name
branch
May 22, 2024 23:51
Thank you @rafaelfranca |
4 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation / Background
Fixes #51720
Detail
Updates
AbstractReflection#klass
and its only subclass overrideMacroReflection#klass
to infer the association class as a top level class if the name of the model without module name-spacing is the same. The current inferrence is due to this logic resolving the name in the current module first, which doesn't make sense in this specific case as it will always resolve to the model itself.Additional information
None.
Checklist
Before submitting the PR make sure the following are checked:
[Fix #issue-number]