Merge pull request #1197 from strongloop/fix/options-propagation
Fix HasOne.update to propagate options arg
This commit is contained in:
commit
a9a4fa498d
|
@ -1743,7 +1743,7 @@ HasOne.prototype.update = function(targetModelData, options, cb) {
|
||||||
this.fetch(function(err, targetModel) {
|
this.fetch(function(err, targetModel) {
|
||||||
if (targetModel instanceof ModelBaseClass) {
|
if (targetModel instanceof ModelBaseClass) {
|
||||||
delete targetModelData[fk];
|
delete targetModelData[fk];
|
||||||
targetModel.updateAttributes(targetModelData, cb);
|
targetModel.updateAttributes(targetModelData, options, cb);
|
||||||
} else {
|
} else {
|
||||||
cb(new Error(g.f('{{HasOne}} relation %s is empty', definition.name)));
|
cb(new Error(g.f('{{HasOne}} relation %s is empty', definition.name)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,36 +35,36 @@ describe('Memory connector with mocked discovery', function() {
|
||||||
dataScale: null,
|
dataScale: null,
|
||||||
nullable: 0,
|
nullable: 0,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
owner: 'STRONGLOOP',
|
owner: 'STRONGLOOP',
|
||||||
tableName: 'INVENTORY',
|
tableName: 'INVENTORY',
|
||||||
columnName: 'LOCATION_ID',
|
columnName: 'LOCATION_ID',
|
||||||
dataType: 'varchar',
|
dataType: 'varchar',
|
||||||
dataLength: 20,
|
dataLength: 20,
|
||||||
dataPrecision: null,
|
dataPrecision: null,
|
||||||
dataScale: null,
|
dataScale: null,
|
||||||
nullable: 0,
|
nullable: 0,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
owner: 'STRONGLOOP',
|
owner: 'STRONGLOOP',
|
||||||
tableName: 'INVENTORY',
|
tableName: 'INVENTORY',
|
||||||
columnName: 'AVAILABLE',
|
columnName: 'AVAILABLE',
|
||||||
dataType: 'int',
|
dataType: 'int',
|
||||||
dataLength: null,
|
dataLength: null,
|
||||||
dataPrecision: 10,
|
dataPrecision: 10,
|
||||||
dataScale: 0,
|
dataScale: 0,
|
||||||
nullable: 1,
|
nullable: 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
owner: 'STRONGLOOP',
|
owner: 'STRONGLOOP',
|
||||||
tableName: 'INVENTORY',
|
tableName: 'INVENTORY',
|
||||||
columnName: 'TOTAL',
|
columnName: 'TOTAL',
|
||||||
dataType: 'int',
|
dataType: 'int',
|
||||||
dataLength: null,
|
dataLength: null,
|
||||||
dataPrecision: 10,
|
dataPrecision: 10,
|
||||||
dataScale: 0,
|
dataScale: 0,
|
||||||
nullable: 1,
|
nullable: 1,
|
||||||
}];
|
}];
|
||||||
|
|
||||||
ds.discoverModelProperties = function(modelName, options, cb) {
|
ds.discoverModelProperties = function(modelName, options, cb) {
|
||||||
process.nextTick(function() {
|
process.nextTick(function() {
|
||||||
|
|
Loading…
Reference in New Issue