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 1d87f43b
authored
Sep 29, 2012
by
Sascha Depold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
don't omit null for associated foreign keys
1 parent
e8597259
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
4 additions
and
4 deletions
lib/associations/has-many-single-linked.js
lib/associations/has-one.js
lib/utils.js
spec/associations/has-many.spec.js
lib/associations/has-many-single-linked.js
View file @
1d87f43
...
...
@@ -22,7 +22,7 @@ module.exports = (function() {
// clear the old associations
oldAssociations
.
forEach
(
function
(
associatedObject
)
{
associatedObject
[
self
.
__factory
.
identifier
]
=
options
.
omitNull
?
''
:
null
associatedObject
[
self
.
__factory
.
identifier
]
=
/*options.omitNull ? '' :*/
null
chainer
.
add
(
associatedObject
.
save
())
})
...
...
lib/associations/has-one.js
View file @
1d87f43
...
...
@@ -54,7 +54,7 @@ module.exports = (function() {
return
new
Utils
.
CustomEventEmitter
(
function
(
emitter
)
{
obj
[
self
.
accessors
.
get
]().
success
(
function
(
oldObj
)
{
if
(
oldObj
)
{
oldObj
[
self
.
identifier
]
=
options
.
omitNull
?
''
:
null
;
oldObj
[
self
.
identifier
]
=
/*options.omitNull ? '' :*/
null
;
oldObj
.
save
()
}
...
...
lib/utils.js
View file @
1d87f43
...
...
@@ -119,7 +119,7 @@ var Utils = module.exports = {
var
_hash
=
{}
Utils
.
_
.
each
(
hash
,
function
(
val
,
key
)
{
if
(
val
!==
null
&&
val
!==
undefined
)
{
if
(
key
.
match
(
/Id$/
)
||
((
val
!==
null
)
&&
(
val
!==
undefined
))
)
{
_hash
[
key
]
=
val
;
}
})
...
...
spec/associations/has-many.spec.js
View file @
1d87f43
...
...
@@ -154,7 +154,7 @@ describe('HasMany', function() {
})
it
(
"clears associations when passing null to the set-method with omitNull set to true"
,
function
(
done
)
{
this
.
sequelize
.
options
.
omitNull
=
true
;
this
.
sequelize
.
options
.
omitNull
=
true
var
User
=
this
.
sequelize
.
define
(
'User'
,
{
username
:
Sequelize
.
STRING
})
,
Task
=
this
.
sequelize
.
define
(
'Task'
,
{
title
:
Sequelize
.
STRING
})
...
...
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