Merge branch 'release/1.3.4' into production
This commit is contained in:
commit
5cbc1e1710
|
@ -876,8 +876,9 @@ DataAccessObject.prototype.updateAttributes = function updateAttributes(data, cb
|
|||
var typedData = {};
|
||||
|
||||
for (var key in data) {
|
||||
// Convert the properties by type
|
||||
inst[key] = data[key];
|
||||
typedData[key] = inst.__data[key];
|
||||
typedData[key] = inst[key];
|
||||
}
|
||||
|
||||
inst._adapter().updateAttributes(model, getIdValue(inst.constructor, inst), inst.constructor._forDB(typedData), function (err) {
|
||||
|
@ -886,7 +887,6 @@ DataAccessObject.prototype.updateAttributes = function updateAttributes(data, cb
|
|||
for (var key in data) {
|
||||
inst.__dataWas[key] = inst.__data[key];
|
||||
}
|
||||
;
|
||||
}
|
||||
done.call(inst, function () {
|
||||
saveDone.call(inst, function () {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "loopback-datasource-juggler",
|
||||
"version": "1.3.3",
|
||||
"version": "1.3.4",
|
||||
"description": "LoopBack DataSoure Juggler",
|
||||
"keywords": [
|
||||
"StrongLoop",
|
||||
|
|
|
@ -486,6 +486,32 @@ describe('DataSource define model', function () {
|
|||
|
||||
});
|
||||
|
||||
it('should update the instance with unknown properties', function (done) {
|
||||
var ds = new DataSource('memory');// define models
|
||||
Post = ds.define('Post', {
|
||||
title: { type: String, length: 255, index: true },
|
||||
content: { type: String }
|
||||
});
|
||||
|
||||
Post.create({title: 'a', content: 'AAA'}, function (err, post) {
|
||||
post.updateAttributes({title: 'b', xyz: 'xyz'}, function (err, p) {
|
||||
should.not.exist(err);
|
||||
p.id.should.be.equal(post.id);
|
||||
p.content.should.be.equal(post.content);
|
||||
p.xyz.should.be.equal('xyz');
|
||||
|
||||
Post.findById(post.id, function (err, p) {
|
||||
p.id.should.be.equal(post.id);
|
||||
p.content.should.be.equal(post.content);
|
||||
p.xyz.should.be.equal('xyz');
|
||||
p.title.should.be.equal('b');
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
it('injects id by default', function (done) {
|
||||
var ds = new ModelBuilder();
|
||||
|
||||
|
|
Loading…
Reference in New Issue