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 3ead869e
authored
Jun 30, 2012
by
Sascha Depold
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #202 from innofluence/createWhitelist
Added a whitelist options when creating
2 parents
d83ca3f7
72d80934
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
6 deletions
lib/dao-factory.js
lib/dao.js
spec-jasmine/dao.spec.js
lib/dao-factory.js
View file @
3ead869
...
...
@@ -187,8 +187,8 @@ module.exports = (function() {
return
instance
}
DAOFactory
.
prototype
.
create
=
function
(
values
)
{
return
this
.
build
(
values
).
save
()
DAOFactory
.
prototype
.
create
=
function
(
values
,
fields
)
{
return
this
.
build
(
values
).
save
(
fields
)
}
DAOFactory
.
prototype
.
__defineGetter__
(
'primaryKeys'
,
function
()
{
...
...
lib/dao.js
View file @
3ead869
...
...
@@ -97,11 +97,14 @@ module.exports = (function() {
var
updatedAtAttr
=
this
.
__options
.
underscored
?
'updated_at'
:
'updatedAt'
if
(
this
.
__options
.
timestamps
&&
this
.
hasOwnProperty
(
updatedAtAttr
))
this
[
updatedAtAttr
]
=
new
Date
()
if
(
this
.
__options
.
timestamps
&&
this
.
hasOwnProperty
(
updatedAtAttr
))
{
var
now
=
new
Date
()
this
[
updatedAtAttr
]
=
now
values
[
updatedAtAttr
]
=
now
}
if
(
this
.
isNewRecord
)
{
return
this
.
QueryInterface
.
insert
(
this
,
this
.
__factory
.
tableName
,
this
.
values
)
return
this
.
QueryInterface
.
insert
(
this
,
this
.
__factory
.
tableName
,
values
)
}
else
{
var
identifier
=
this
.
__options
.
hasPrimaryKeys
?
this
.
primaryKeyValues
:
this
.
id
,
tableName
=
this
.
__factory
.
tableName
...
...
spec-jasmine/dao.spec.js
View file @
3ead869
...
...
@@ -411,7 +411,7 @@ describe('DAO', function() {
var
now
=
Date
.
now
()
,
user
=
null
,
updatedAt
=
null
Helpers
.
async
(
function
(
done
)
{
// timeout is needed, in order to check the update of the timestamp
setTimeout
(
function
()
{
...
...
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