Skip to content

Fix belongsTo where params#658

Merged
janmeier merged 2 commits intosequelize:masterfrom
mweibel:fix-belongs-to-where-params
Jun 5, 2013
Merged

Fix belongsTo where params#658
janmeier merged 2 commits intosequelize:masterfrom
mweibel:fix-belongs-to-where-params

Conversation

@mweibel
Copy link
Copy Markdown
Contributor

@mweibel mweibel commented May 30, 2013

Usually when adding to a foobar.getBla() a where param
like foobar.getBla({where: {x: "y"}}) it should extend
the existing where param ("id": id) with the additional
where param.
This didn't work for belongsTo associations until now.

@mweibel
Copy link
Copy Markdown
Contributor Author

mweibel commented May 30, 2013

I don't think the build failed because of my changes, can you please restart it?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch - but I think an else case is missing here.

if (!Utils._.isUndefined(params.where)) {
  params.where = Utils._.extend({id:id}, params.where)
} else {
  params.where = { id : id }
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, will fix this in another commit.

@mweibel
Copy link
Copy Markdown
Contributor Author

mweibel commented Jun 1, 2013

Travis broke again, In case you'd want to assure it works, restart the build please :) thanks

janmeier added a commit that referenced this pull request Jun 5, 2013
@janmeier janmeier merged commit 67b0c6c into sequelize:master Jun 5, 2013
@mweibel mweibel deleted the fix-belongs-to-where-params branch January 19, 2014 12:12
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