-
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
Association with the same name as the demodularized model name is incorrectly inferred #51720
Labels
Comments
joshuay03
changed the title
Association with the same name as the demodularized model nam is not inferred automatically
Association with the same name as the demodularized model name is not inferred automatically
May 3, 2024
joshuay03
changed the title
Association with the same name as the demodularized model name is not inferred automatically
Association with the same name as the demodularized model name is incorrectly inferred
May 3, 2024
joshuay03
added a commit
to joshuay03/rails
that referenced
this issue
May 3, 2024
…ame demodularized name
Merged
4 tasks
joshuay03
added a commit
to joshuay03/rails
that referenced
this issue
May 3, 2024
…ame demodularized name
joshuay03
added a commit
to joshuay03/rails
that referenced
this issue
May 3, 2024
…ame demodularized name
joshuay03
added a commit
to joshuay03/rails
that referenced
this issue
May 3, 2024
…ame demodularized name
joshuay03
added a commit
to joshuay03/rails
that referenced
this issue
May 3, 2024
…ame demodularized name
joshuay03
added a commit
to joshuay03/rails
that referenced
this issue
May 5, 2024
…ame demodularized name
joshuay03
added a commit
to joshuay03/rails
that referenced
this issue
May 22, 2024
…ame demodularized name
rafaelfranca
added a commit
that referenced
this issue
May 22, 2024
…-demodularized-model-name [Fix #51720] Infer association klass as top level if model has same demodularized name
rafaelfranca
added a commit
that referenced
this issue
May 22, 2024
…-demodularized-model-name [Fix #51720] Infer association klass as top level if model has same demodularized name
4 tasks
xjunior
pushed a commit
to xjunior/rails
that referenced
this issue
Jun 9, 2024
…ame demodularized name
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Steps to reproduce
I think it's easiest to explain this with a script.
Results in:
The only workaround is to update the association on
Namespaced::Post
to be:The
::
ensures that it's resolved as an absolute constant.See #51721 for a proposed fix.
Expected behavior
Association model is inferred to be a top level model that matches its name.
Actual behavior
Association model is inferred to be the model it's defined on.
System configuration
Rails version: main
Ruby version: 3.2.2
The text was updated successfully, but these errors were encountered: