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 8eb98ece
authored
Sep 10, 2014
by
Mick Hansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(include.association): fix bug with include.association and instance.reload
1 parent
6d51642b
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
7 deletions
lib/model.js
test/dao-factory/find.test.js
test/dao-factory/findAll.test.js
test/dao.test.js
lib/model.js
View file @
8eb98ec
...
@@ -1822,7 +1822,7 @@ module.exports = (function() {
...
@@ -1822,7 +1822,7 @@ module.exports = (function() {
throw
new
Error
(
'Include malformed. Expected attributes: model or association'
);
throw
new
Error
(
'Include malformed. Expected attributes: model or association'
);
}
}
if
(
include
.
association
&&
!
include
.
_pseudo
)
include
.
model
=
include
.
association
.
source
;
if
(
include
.
association
&&
!
include
.
_pseudo
&&
!
include
.
model
)
include
.
model
=
include
.
association
.
source
;
tableNames
[
include
.
model
.
getTableName
()]
=
true
;
tableNames
[
include
.
model
.
getTableName
()]
=
true
;
...
...
test/dao-factory/find.test.js
View file @
8eb98ec
...
@@ -330,7 +330,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -330,7 +330,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
var
self
=
this
var
self
=
this
expect
(
function
()
{
expect
(
function
()
{
self
.
Worker
.
find
({
include
:
[
1
]
})
self
.
Worker
.
find
({
include
:
[
1
]
})
}).
to
.
throw
(
Error
,
'Include unexpected. Element has to be either an instance of Model or an object.'
)
}).
to
.
throw
(
Error
)
done
()
done
()
})
})
...
...
test/dao-factory/findAll.test.js
View file @
8eb98ec
...
@@ -577,7 +577,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
...
@@ -577,7 +577,7 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
var
self
=
this
var
self
=
this
expect
(
function
()
{
expect
(
function
()
{
self
.
Worker
.
all
({
include
:
[
1
]
})
self
.
Worker
.
all
({
include
:
[
1
]
})
}).
to
.
throw
(
Error
,
'Include unexpected. Element has to be either an instance of Model or an object.'
)
}).
to
.
throw
(
Error
)
done
()
done
()
})
})
...
...
test/dao.test.js
View file @
8eb98ec
...
@@ -543,7 +543,7 @@ describe(Support.getTestDialectTeaser("DAO"), function () {
...
@@ -543,7 +543,7 @@ describe(Support.getTestDialectTeaser("DAO"), function () {
})
})
})
})
describe
(
'reload'
,
function
()
{
describe
.
only
(
'reload'
,
function
()
{
it
(
'supports transactions'
,
function
(
done
)
{
it
(
'supports transactions'
,
function
(
done
)
{
Support
.
prepareTransactionTest
(
this
.
sequelize
,
function
(
sequelize
)
{
Support
.
prepareTransactionTest
(
this
.
sequelize
,
function
(
sequelize
)
{
var
User
=
sequelize
.
define
(
'User'
,
{
username
:
Support
.
Sequelize
.
STRING
})
var
User
=
sequelize
.
define
(
'User'
,
{
username
:
Support
.
Sequelize
.
STRING
})
...
@@ -623,8 +623,8 @@ describe(Support.getTestDialectTeaser("DAO"), function () {
...
@@ -623,8 +623,8 @@ describe(Support.getTestDialectTeaser("DAO"), function () {
Book
.
hasMany
(
Page
)
Book
.
hasMany
(
Page
)
Page
.
belongsTo
(
Book
)
Page
.
belongsTo
(
Book
)
Book
.
sync
().
success
(
function
()
{
Book
.
sync
(
{
force
:
true
}
).
success
(
function
()
{
Page
.
sync
().
success
(
function
()
{
Page
.
sync
(
{
force
:
true
}
).
success
(
function
()
{
Book
.
create
({
title
:
'A very old book'
}).
success
(
function
(
book
)
{
Book
.
create
({
title
:
'A very old book'
}).
success
(
function
(
book
)
{
Page
.
create
({
content
:
'om nom nom'
}).
success
(
function
(
page
)
{
Page
.
create
({
content
:
'om nom nom'
}).
success
(
function
(
page
)
{
book
.
setPages
([
page
]).
success
(
function
()
{
book
.
setPages
([
page
]).
success
(
function
()
{
...
@@ -642,7 +642,7 @@ describe(Support.getTestDialectTeaser("DAO"), function () {
...
@@ -642,7 +642,7 @@ describe(Support.getTestDialectTeaser("DAO"), function () {
expect
(
leBook
.
Pages
[
0
].
content
).
to
.
equal
(
'something totally different'
)
expect
(
leBook
.
Pages
[
0
].
content
).
to
.
equal
(
'something totally different'
)
expect
(
page
.
content
).
to
.
equal
(
'something totally different'
)
expect
(
page
.
content
).
to
.
equal
(
'something totally different'
)
done
()
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