-
Notifications
You must be signed in to change notification settings - Fork 64
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
Fixing query with has_one #263
Conversation
@paulcsmith if you have a few min, I need to get back on this one. Maybe a second set of eyes would be great. Thanks! |
@jwoertink Could you rebase and push? I'll try to take a look this evening! Thanks for the ping :D |
Alright, this is a long time coming 😅 It took me a min to remember what all is going on here, but it's all looking good now. |
@@ -11,7 +11,7 @@ module Avram::Associations::HasOne | |||
{% end %} | |||
|
|||
{% unless foreign_key %} | |||
{% foreign_key = "#{@type.name.underscore}_id".id %} | |||
{% foreign_key = "#{@type.name.underscore.split("::").last.id}_id".id %} |
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.
This was fixed under the has_many a long time ago, so this now fixes it for the has_one
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.
Looks perfect!
It still says WIP so holding off on merging just in case you wanted to do something else. Feel free to merge when you’re ready |
oh, oops! Ok. I'll take one last look over it, but I'm pretty sure it's ready to go |
Fixes #223
This fixes 2 main issues with the
has_one
:has_one
when your model is namespaced