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 2fec91ae
authored
Nov 06, 2012
by
Sascha Depold
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
git://github.com/ghernandez345/sequelize
into ghernandez345-master
2 parents
441ea3d8
d5197aa6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
1 deletions
lib/dao-factory.js
spec/dao-factory.spec.js
lib/dao-factory.js
View file @
2fec91a
...
@@ -127,7 +127,14 @@ module.exports = (function() {
...
@@ -127,7 +127,14 @@ module.exports = (function() {
var
primaryKeys
=
this
.
primaryKeys
;
var
primaryKeys
=
this
.
primaryKeys
;
// options is not a hash but an id
// options is not a hash but an id
if
(
typeof
options
===
'number'
)
{
if
(
typeof
options
===
'string'
)
{
var
parsedId
=
parseInt
(
options
,
10
);
if
(
!
Utils
.
_
.
isFinite
(
parsedId
))
{
throw
new
Error
(
'Invalid argument to find(). Must be an id or an options object.'
)
}
options
=
{
where
:
parsedId
}
}
else
if
(
typeof
options
===
'number'
)
{
options
=
{
where
:
options
}
options
=
{
where
:
options
}
}
else
if
(
Utils
.
_
.
size
(
primaryKeys
)
&&
Utils
.
argsArePrimaryKeys
(
arguments
,
primaryKeys
))
{
}
else
if
(
Utils
.
_
.
size
(
primaryKeys
)
&&
Utils
.
argsArePrimaryKeys
(
arguments
,
primaryKeys
))
{
var
where
=
{}
var
where
=
{}
...
...
spec/dao-factory.spec.js
View file @
2fec91a
...
@@ -300,6 +300,15 @@ describe("[" + dialect.toUpperCase() + "] DAOFactory", function() {
...
@@ -300,6 +300,15 @@ describe("[" + dialect.toUpperCase() + "] DAOFactory", function() {
}.
bind
(
this
))
}.
bind
(
this
))
})
})
it
(
'returns a single dao given a string id'
,
function
(
done
)
{
this
.
User
.
find
(
this
.
user
.
id
+
''
).
success
(
function
(
user
)
{
expect
(
Array
.
isArray
(
user
)).
toBeFalsy
()
expect
(
user
.
id
).
toEqual
(
this
.
user
.
id
)
expect
(
user
.
id
).
toEqual
(
1
)
done
()
}.
bind
(
this
))
})
it
(
"should make aliased attributes available"
,
function
(
done
)
{
it
(
"should make aliased attributes available"
,
function
(
done
)
{
this
.
User
.
find
({
this
.
User
.
find
({
where
:
{
id
:
1
},
where
:
{
id
:
1
},
...
...
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