fix(model): check attribute overrides when defining assoc mixins (#9952) - #9953
Merged
sushantdhiman merged 1 commit intoSep 28, 2018
Merged
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.
|
| 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]]) { |
Contributor
There was a problem hiding this comment.
Just !obj.hasOwnProperty(association.accessors[method]) should be enough
Contributor
Author
|
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>
.
|
Contributor
|
Just change this, I'll see if i can fix those tests |
Contributor
Author
|
Ok, I've updated that line to just use the |
bkoltai
force-pushed
the
9952-fix-custom-method-override-check
branch
from
September 27, 2018 15:02
af1e95f to
35a80ae
Compare
Contributor
|
Looks like all tests are passing, merging |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of change
Closes #9952