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 belongsTo where params #658

Merged
merged 2 commits into from Jun 5, 2013

Conversation

2 participants
@mweibel
Contributor

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

This comment has been minimized.

Contributor

mweibel commented May 30, 2013

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

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

This comment has been minimized.

@janmeier

janmeier May 31, 2013

Member

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 }
}

This comment has been minimized.

@mweibel

mweibel May 31, 2013

Contributor

Oh yeah, will fix this in another commit.

@mweibel

This comment has been minimized.

Contributor

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

1 check passed

default The Travis CI build passed
Details

@mweibel mweibel deleted the mweibel:fix-belongs-to-where-params branch Jan 19, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment