Skip to content

Commit a9a4fa4

Browse files
authored
Merge pull request #1197 from strongloop/fix/options-propagation
Fix HasOne.update to propagate options arg
2 parents d99dca6 + 2ca0812 commit a9a4fa4

File tree

2 files changed

+31
-31
lines changed

2 files changed

+31
-31
lines changed

lib/relation-definition.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1743,7 +1743,7 @@ HasOne.prototype.update = function(targetModelData, options, cb) {
17431743
this.fetch(function(err, targetModel) {
17441744
if (targetModel instanceof ModelBaseClass) {
17451745
delete targetModelData[fk];
1746-
targetModel.updateAttributes(targetModelData, cb);
1746+
targetModel.updateAttributes(targetModelData, options, cb);
17471747
} else {
17481748
cb(new Error(g.f('{{HasOne}} relation %s is empty', definition.name)));
17491749
}

test/discovery.test.js

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -35,36 +35,36 @@ describe('Memory connector with mocked discovery', function() {
3535
dataScale: null,
3636
nullable: 0,
3737
},
38-
{
39-
owner: 'STRONGLOOP',
40-
tableName: 'INVENTORY',
41-
columnName: 'LOCATION_ID',
42-
dataType: 'varchar',
43-
dataLength: 20,
44-
dataPrecision: null,
45-
dataScale: null,
46-
nullable: 0,
47-
},
48-
{
49-
owner: 'STRONGLOOP',
50-
tableName: 'INVENTORY',
51-
columnName: 'AVAILABLE',
52-
dataType: 'int',
53-
dataLength: null,
54-
dataPrecision: 10,
55-
dataScale: 0,
56-
nullable: 1,
57-
},
58-
{
59-
owner: 'STRONGLOOP',
60-
tableName: 'INVENTORY',
61-
columnName: 'TOTAL',
62-
dataType: 'int',
63-
dataLength: null,
64-
dataPrecision: 10,
65-
dataScale: 0,
66-
nullable: 1,
67-
}];
38+
{
39+
owner: 'STRONGLOOP',
40+
tableName: 'INVENTORY',
41+
columnName: 'LOCATION_ID',
42+
dataType: 'varchar',
43+
dataLength: 20,
44+
dataPrecision: null,
45+
dataScale: null,
46+
nullable: 0,
47+
},
48+
{
49+
owner: 'STRONGLOOP',
50+
tableName: 'INVENTORY',
51+
columnName: 'AVAILABLE',
52+
dataType: 'int',
53+
dataLength: null,
54+
dataPrecision: 10,
55+
dataScale: 0,
56+
nullable: 1,
57+
},
58+
{
59+
owner: 'STRONGLOOP',
60+
tableName: 'INVENTORY',
61+
columnName: 'TOTAL',
62+
dataType: 'int',
63+
dataLength: null,
64+
dataPrecision: 10,
65+
dataScale: 0,
66+
nullable: 1,
67+
}];
6868

6969
ds.discoverModelProperties = function(modelName, options, cb) {
7070
process.nextTick(function() {

0 commit comments

Comments
 (0)