Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
public
/
sequelize
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
不要怂,就是干,撸起袖子干!
Commit 78bb1a2a
authored
Feb 07, 2014
by
Mick Hansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make sure we atleast have primarykey: null for bulkCreate
1 parent
46f8b891
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
2 deletions
lib/dao.js
test/dao/values.test.js
lib/dao.js
View file @
78bb1a2
...
@@ -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
)
{
...
...
test/dao/values.test.js
View file @
78bb1a2
...
@@ -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
)
{
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment