Skip to content

fix(model): check attribute overrides when defining assoc mixins (#9952) - #9953

Merged
sushantdhiman merged 1 commit into
sequelize:masterfrom
bkoltai:9952-fix-custom-method-override-check
Sep 28, 2018
Merged

fix(model): check attribute overrides when defining assoc mixins (#9952)#9953
sushantdhiman merged 1 commit into
sequelize:masterfrom
bkoltai:9952-fix-custom-method-override-check

Conversation

@bkoltai

@bkoltai bkoltai commented Sep 24, 2018

Copy link
Copy Markdown
Contributor

Description of change

Closes #9952

@codecov

codecov Bot commented Sep 25, 2018

Copy link
Copy Markdown

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.

Comment thread lib/associations/helpers.js Outdated
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
Copy Markdown
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

bkoltai commented Sep 25, 2018 via email

Copy link
Copy Markdown
Contributor Author

@sushantdhiman

Copy link
Copy Markdown
Contributor

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

@bkoltai

bkoltai commented Sep 27, 2018

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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.

2 participants