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?? |
|
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. |
MrJakeReid
left a comment
There was a problem hiding this comment.
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. |
| 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.
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.
like source_type, 2? but I doubt it will meant much for people without the full context of polymorphic setting (activeRecord, reflections and mapping)
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_typeoptions exist for eitherhas_manyorhas_oneassociation/reflection and existing proper value for theforeign_typeandinteger_mapping_type.