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 e8dc3b27
authored
May 24, 2014
by
Mick Hansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #1792 - Don't coerce attribute names to string when checking for mappings
1 parent
89ec5c00
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
lib/model.js
lib/model.js
View file @
e8dc3b2
...
@@ -1461,6 +1461,9 @@ module.exports = (function() {
...
@@ -1461,6 +1461,9 @@ module.exports = (function() {
var
mapFieldNames
=
function
(
options
,
Model
)
{
var
mapFieldNames
=
function
(
options
,
Model
)
{
if
(
options
.
attributes
)
{
if
(
options
.
attributes
)
{
options
.
attributes
=
options
.
attributes
.
map
(
function
(
attr
)
{
options
.
attributes
=
options
.
attributes
.
map
(
function
(
attr
)
{
// Object lookups will force any variable to strings, we don't want that for special objects etc
if
(
typeof
attr
!==
"string"
)
return
attr
;
// Map attributes to aliased syntax attributes
if
(
Model
.
rawAttributes
[
attr
]
&&
Model
.
rawAttributes
[
attr
].
field
)
{
if
(
Model
.
rawAttributes
[
attr
]
&&
Model
.
rawAttributes
[
attr
].
field
)
{
return
[
Model
.
rawAttributes
[
attr
].
field
,
attr
];
return
[
Model
.
rawAttributes
[
attr
].
field
,
attr
];
}
}
...
@@ -1470,9 +1473,11 @@ module.exports = (function() {
...
@@ -1470,9 +1473,11 @@ module.exports = (function() {
if
(
options
.
where
)
{
if
(
options
.
where
)
{
for
(
var
attr
in
options
.
where
)
{
for
(
var
attr
in
options
.
where
)
{
if
(
Model
.
rawAttributes
[
attr
]
&&
Model
.
rawAttributes
[
attr
].
field
)
{
if
(
typeof
attr
===
"string"
)
{
options
.
where
[
Model
.
rawAttributes
[
attr
].
field
]
=
options
.
where
[
attr
];
if
(
Model
.
rawAttributes
[
attr
]
&&
Model
.
rawAttributes
[
attr
].
field
)
{
delete
options
.
where
[
attr
];
options
.
where
[
Model
.
rawAttributes
[
attr
].
field
]
=
options
.
where
[
attr
];
delete
options
.
where
[
attr
];
}
}
}
}
}
}
}
...
...
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