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 7370a098
authored
Jul 20, 2015
by
Mick Hansen
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4138 from sequelize/fix-update-set-options
update should pass options to set
2 parents
e368ce68
e37f3340
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
lib/instance.js
lib/model.js
lib/instance.js
View file @
7370a09
...
@@ -770,12 +770,15 @@ Instance.prototype.hookValidate = function(options) {
...
@@ -770,12 +770,15 @@ Instance.prototype.hookValidate = function(options) {
Instance
.
prototype
.
update
=
function
(
values
,
options
)
{
Instance
.
prototype
.
update
=
function
(
values
,
options
)
{
var
changedBefore
=
this
.
changed
()
||
[]
var
changedBefore
=
this
.
changed
()
||
[]
,
sideEffects
,
sideEffects
,
fields
;
,
fields
,
setOptions
;
options
=
options
||
{};
options
=
options
||
{};
if
(
Array
.
isArray
(
options
))
options
=
{
fields
:
options
};
if
(
Array
.
isArray
(
options
))
options
=
{
fields
:
options
};
this
.
set
(
values
,
{
attributes
:
options
.
fields
});
setOptions
=
this
.
$Model
.
$optClone
(
options
);
setOptions
.
attributes
=
options
.
fields
;
this
.
set
(
values
,
setOptions
);
// Now we need to figure out which fields were actually affected by the setter.
// Now we need to figure out which fields were actually affected by the setter.
sideEffects
=
_
.
without
.
apply
(
this
,
[
this
.
changed
()
||
[]].
concat
(
changedBefore
));
sideEffects
=
_
.
without
.
apply
(
this
,
[
this
.
changed
()
||
[]].
concat
(
changedBefore
));
...
...
lib/model.js
View file @
7370a09
...
@@ -285,7 +285,7 @@ var conformOptions = function(options, self) {
...
@@ -285,7 +285,7 @@ var conformOptions = function(options, self) {
});
});
};
};
var
optClone
=
Model
.
prototype
.
__optClone
=
function
(
options
)
{
var
optClone
=
Model
.
prototype
.
__optClone
=
Model
.
prototype
.
$optClone
=
function
(
options
)
{
options
=
options
||
{};
options
=
options
||
{};
return
Utils
.
cloneDeep
(
options
,
function
(
elem
)
{
return
Utils
.
cloneDeep
(
options
,
function
(
elem
)
{
// The InstanceFactories used for include are pass by ref, so don't clone them.
// The InstanceFactories used for include are pass by ref, so don't clone them.
...
...
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