-
Notifications
You must be signed in to change notification settings - Fork 35
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
Write attribute with polymorphic integer type #61
Conversation
dd95d02
to
c480a89
Compare
c480a89
to
504bca4
Compare
504bca4
to
f77fc1e
Compare
Curious as to why this is a "temp" PR?? |
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.
changes LGTM, if you can send over some QA steps I can help test this out as well and do a bit of regression testing too
ONe more case, which I think we should consider if we want to do this correctly: What should the type column be in this case? I think it should match D but we should double-check how current polymorphism works. |
you can easier clone the repo and checkout my branch to set to your local project Gemfile |
The native polymorphic is assigning type as B. Basically the class that has the actual reflection setup. |
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.
We went through the QA and the explanation of the team, thank you for the walkthrough and jumping on the fix!
8f727b1
bbcdc49
to
8f727b1
Compare
Cool -> let's add a spec for that, and then I'm good, |
there is a test that exist previously already done the job, when |
8f727b1
to
5d258ed
Compare
Suggested a few other reviewers; this seems fine to me and fixes an issue we'd have to have worked around, but I'd love at least another consideration of wtf could go wrong when this ships to manage. |
Nice! I will keep it open for couple more days. |
@@ -64,8 +68,10 @@ def remove_type_and_establish_mapping(name, options, scope) | |||
condition = instance_exec(&scope).merge(condition) if scope.is_a?(Proc) | |||
condition | |||
} | |||
return foreign_type, klass_mapping.to_i |
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.
For readability sake, what do you think about adding a comment with an example of what we're expecting to return?
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.
like source_type, 2
? but I doubt it will meant much for people without the full context of polymorphic setting (activeRecord, reflections and mapping)
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.
That's true! Never mind then!
5d258ed
to
2164bf3
Compare
Resolved #14
Resolved #17
This is a PR for fixing the problem of below example, by manually write to record when there's
integer_type
options exist for eitherhas_many
orhas_one
association/reflection and existing proper value for theforeign_type
andinteger_mapping_type
.