不要怂,就是干,撸起袖子干!

Commit 78bb1a2a by Mick Hansen

make sure we atleast have primarykey: null for bulkCreate

1 parent 46f8b891
Showing with 5 additions and 2 deletions
...@@ -627,10 +627,13 @@ module.exports = (function() { ...@@ -627,10 +627,13 @@ module.exports = (function() {
// private // private
var initValues = function(values, options) { var initValues = function(values, options) {
// set id to null if not passed as value, a newly created dao has no id
var defaults = {}, var defaults = {},
key; key;
// set id to null if not passed as value, a newly created dao has no id
// removing this breaks bulkCreate
defaults[this.Model.primaryKeyAttribute] = null;
values = values && _.clone(values) || {} values = values && _.clone(values) || {}
if (options.isNewRecord) { if (options.isNewRecord) {
......
...@@ -208,7 +208,7 @@ describe(Support.getTestDialectTeaser("DAO"), function () { ...@@ -208,7 +208,7 @@ describe(Support.getTestDialectTeaser("DAO"), function () {
var product = Product.build({ var product = Product.build({
price: 10 price: 10
}) })
expect(product.toJSON()).to.deep.equal({withTaxes: 1250, price: 1000}) expect(product.toJSON()).to.deep.equal({withTaxes: 1250, price: 1000, id: null})
}) })
it('should work with save', function (done) { it('should work with save', function (done) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!