Skip to content

Commit aa402f4

Browse files
committed
parse insert returning *
1 parent 603a6bf commit aa402f4

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

lib/model.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,10 +1017,10 @@ var BookshelfModel = _model2.default.extend({
10171017
throw new this.constructor.NoRowsUpdatedError('No Rows Updated');
10181018
}
10191019
} else {
1020-
var returningAttrs = resp[0];
1021-
var updatedCols = {};
1022-
updatedCols[this.idAttribute] = this.id = returningAttrs.id;
1023-
delete returningAttrs.id;
1020+
var updatedCols = resp[0];
1021+
var idAttribute = updatedCols.id;
1022+
delete updatedCols.id;
1023+
updatedCols[this.idAttribute] = this.id = idAttribute;
10241024
var updatedAttrs = this.parse(updatedCols);
10251025
_lodash2.default.assign(this.attributes, updatedAttrs);
10261026
}

src/model.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -984,10 +984,10 @@ const BookshelfModel = ModelBase.extend({
984984
throw new this.constructor.NoRowsUpdatedError('No Rows Updated');
985985
}
986986
} else {
987-
const returningAttrs = resp[0];
988-
const updatedCols = {};
989-
updatedCols[this.idAttribute] = this.id = returningAttrs.id;
990-
delete returningAttrs.id;
987+
const updatedCols = resp[0];
988+
const idAttribute = updatedCols.id;
989+
delete updatedCols.id;
990+
updatedCols[this.idAttribute] = this.id = idAttribute;
991991
const updatedAttrs = this.parse(updatedCols);
992992
_.assign(this.attributes, updatedAttrs);
993993
}

0 commit comments

Comments
 (0)