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(model): check attribute overrides when defining assoc mixins (#9952) #9953
fix(model): check attribute overrides when defining assoc mixins (#9952) #9953
Conversation
Codecov Report
@@ Coverage Diff @@
## master #9953 +/- ##
=======================================
Coverage 96.09% 96.09%
=======================================
Files 63 63
Lines 9402 9402
=======================================
Hits 9035 9035
Misses 367 367
Continue to review full report at Codecov.
|
lib/associations/helpers.js
Outdated
@@ -57,7 +57,7 @@ function mixinMethods(association, obj, methods, aliases) { | |||
|
|||
for (const method of methods) { | |||
// don't override custom methods | |||
if (!obj[association.accessors[method]]) { | |||
if (!obj.hasOwnProperty(association.accessors[method]) && !obj[association.accessors[method]]) { |
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.
Just !obj.hasOwnProperty(association.accessors[method])
should be enough
I thought so too but when I had that a bunch of other tests failed. I
believe it has something to do with the dynamic nature of some of the
method calls on models
…On Mon, Sep 24, 2018 at 10:43 PM Sushant ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In lib/associations/helpers.js
<#9953 (comment)>:
> @@ -57,7 +57,7 @@ function mixinMethods(association, obj, methods, aliases) {
for (const method of methods) {
// don't override custom methods
- if (!obj[association.accessors[method]]) {
+ if (!obj.hasOwnProperty(association.accessors[method]) && !obj[association.accessors[method]]) {
Just !obj.hasOwnProperty(association.accessors[method]) should be enough
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#9953 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAcXfOyZg19bAHlbWpdzvCNrj_cgI7JQks5uecKEgaJpZM4W3Nbs>
.
|
Just change this, I'll see if i can fix those tests |
Ok, I've updated that line to just use the |
af1e95f
to
35a80ae
Compare
Looks like all tests are passing, merging |
Description of change
Closes #9952