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 364e601d
authored
Aug 03, 2015
by
Jan Aagaard Meier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug(scopes) Fix addscope when model does not have any inital scopes. Closes #4243
1 parent
5858e027
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
2 deletions
changelog.md
lib/model.js
test/unit/model/scope.test.js
changelog.md
View file @
364e601
# Next
# Next
-
[
FIXED
]
Map column names with
`.field`
in scopes with includes.
[
#4210
](
https://github.com/sequelize/sequelize/issues/4210
)
-
[
FIXED
]
Map column names with
`.field`
in scopes with includes.
[
#4210
](
https://github.com/sequelize/sequelize/issues/4210
)
-
[
FIXED
]
`addScope`
when the model does not have any initial scopes
[
#4243
](
https://github.com/sequelize/sequelize/issues/4243
)
# 3.5.1
# 3.5.1
-
[
FIXED
]
Fix bug with nested includes where a middle include results in a null value which breaks $findSeperate.
-
[
FIXED
]
Fix bug with nested includes where a middle include results in a null value which breaks $findSeperate.
...
...
lib/model.js
View file @
364e601
...
@@ -36,7 +36,7 @@ var Model = function(name, attributes, options) {
...
@@ -36,7 +36,7 @@ var Model = function(name, attributes, options) {
schema
:
null
,
schema
:
null
,
schemaDelimiter
:
''
,
schemaDelimiter
:
''
,
defaultScope
:
null
,
defaultScope
:
null
,
scopes
:
null
,
scopes
:
[]
,
hooks
:
{},
hooks
:
{},
indexes
:
[]
indexes
:
[]
},
options
||
{});
},
options
||
{});
...
@@ -1342,7 +1342,7 @@ Model.$findSeperate = function(results, options) {
...
@@ -1342,7 +1342,7 @@ Model.$findSeperate = function(results, options) {
var
original
=
results
;
var
original
=
results
;
if
(
options
.
plain
)
results
=
[
results
];
if
(
options
.
plain
)
results
=
[
results
];
if
(
!
results
.
length
)
return
original
;
if
(
!
results
.
length
)
return
original
;
return
Promise
.
map
(
options
.
include
,
function
(
include
)
{
return
Promise
.
map
(
options
.
include
,
function
(
include
)
{
...
...
test/unit/model/scope.test.js
View file @
364e601
...
@@ -158,6 +158,14 @@ describe(Support.getTestDialectTeaser('Model'), function() {
...
@@ -158,6 +158,14 @@ describe(Support.getTestDialectTeaser('Model'), function() {
});
});
describe
(
'addScope'
,
function
()
{
describe
(
'addScope'
,
function
()
{
it
(
'works if the model does not have any initial scopes'
,
function
()
{
var
Model
=
current
.
define
(
'model'
);
expect
(
function
()
{
Model
.
addScope
(
'anything'
,
{});
}).
not
.
to
.
throw
();
});
it
(
'allows me to add a new scope'
,
function
()
{
it
(
'allows me to add a new scope'
,
function
()
{
expect
(
function
()
{
expect
(
function
()
{
Company
.
scope
(
'newScope'
);
Company
.
scope
(
'newScope'
);
...
...
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