You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Update items fail on remapped column - instance from find method #509
I cannot recreate this issue.
Please see the tests. .one() calls .find() internally.
Even if I change the one() to find() the test still passes.
Can you provide a more complete example, or tweak the test to make it fail as it does for you? Thanks.
Haha, yeh.. I didn't think setting mapsTo on keys would work. Will look into it.
Edit: setting id: [...] and key: true should be equivalent so I'll look at fixing that also.
Activity
hkbenchan commentedon May 26, 2014
Similar to #506
dxg commentedon May 26, 2014
I cannot recreate this issue.
Please see the tests.
.one()calls.find()internally.Even if I change the
one()tofind()the test still passes.Can you provide a more complete example, or tweak the test to make it fail as it does for you? Thanks.
hkbenchan commentedon May 26, 2014
Please try this.
I guess the reason that your tests are passed is the remap key is not the primary key, so that's why it will pass the condition.
dxg commentedon May 27, 2014
Haha, yeh.. I didn't think setting
mapsToon keys would work. Will look into it.Edit: setting
id: [...]andkey: trueshould be equivalent so I'll look at fixing that also.dxg commentedon Jun 2, 2014
I believe I fixed it.
Please try the latest master version.
hkbenchan commentedon Jun 2, 2014
The bug is not fixed, how should I say, becoming worse
original the sql generated is:
new the sql generated is:
which update all records
for now I will fall back not to use the mapsTo feature on primary key, will look at it later when I finish development on the part
dxg commentedon Jun 3, 2014
The update does fail as you show, but that's because the keys are defined incorrectly:
Since neither of those properties exists, it acts as if the model has no keys.
The following works:
however I recommend the
key: truesyntax which works too:I'll make the model definition throw some sort of error when invalid keys are specified.
Throw error if model has no keys defined. #509