Skip to content
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

Merged

Conversation

bkoltai
Copy link
Contributor

@bkoltai bkoltai commented Sep 24, 2018

Description of change

Closes #9952

@codecov
Copy link

codecov bot commented Sep 25, 2018

Codecov Report

Merging #9953 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #9953   +/-   ##
=======================================
  Coverage   96.09%   96.09%           
=======================================
  Files          63       63           
  Lines        9402     9402           
=======================================
  Hits         9035     9035           
  Misses        367      367
Impacted Files Coverage Δ
lib/associations/helpers.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 214c791...35a80ae. Read the comment docs.

@@ -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]]) {
Copy link
Contributor

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

@bkoltai
Copy link
Contributor Author

bkoltai commented Sep 25, 2018 via email

@sushantdhiman
Copy link
Contributor

Just change this, I'll see if i can fix those tests

@bkoltai
Copy link
Contributor Author

bkoltai commented Sep 27, 2018

Ok, I've updated that line to just use the hasOwnProperty

@bkoltai bkoltai force-pushed the 9952-fix-custom-method-override-check branch from af1e95f to 35a80ae Compare September 27, 2018 15:02
@sushantdhiman
Copy link
Contributor

Looks like all tests are passing, merging

@sushantdhiman sushantdhiman merged commit 71e3b59 into sequelize:master Sep 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants