Skip to content

Commit

Permalink
Fix: fix add data on relation model
Browse files Browse the repository at this point in the history
  • Loading branch information
welefen committed Feb 25, 2016
1 parent ee76c7e commit fef65a9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/model/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ export default class extends Base {

await this.db().add(parsedData, options, replace);
let insertId = parsedData[this.pk] = this.db().getLastInsertId();
await this.afterAdd(parsedData, options);
let copyData = think.extend({}, data, parsedData, {[this.pk]: insertId});
await this.afterAdd(copyData, options);
return insertId;
}
/**
Expand Down Expand Up @@ -311,7 +312,7 @@ export default class extends Base {
}

let rows = await this.db().update(parsedData, options);
let copyData = think.extend({}, parsedData);
let copyData = think.extend({}, data, parsedData);
await this.afterUpdate(copyData, options);
return rows;
}
Expand Down

0 comments on commit fef65a9

Please sign in to comment.