不要怂,就是干,撸起袖子干!

Commit ba9e5e46 by Jan Aagaard Meier

added options to specify whitelist when creating

1 parent 32e7f27d
...@@ -187,8 +187,8 @@ module.exports = (function() { ...@@ -187,8 +187,8 @@ module.exports = (function() {
return instance return instance
} }
DAOFactory.prototype.create = function(values) { DAOFactory.prototype.create = function(values, fields) {
return this.build(values).save() return this.build(values).save(fields)
} }
DAOFactory.prototype.__defineGetter__('primaryKeys', function() { DAOFactory.prototype.__defineGetter__('primaryKeys', function() {
......
...@@ -97,11 +97,14 @@ module.exports = (function() { ...@@ -97,11 +97,14 @@ module.exports = (function() {
var updatedAtAttr = this.__options.underscored ? 'updated_at' : 'updatedAt' var updatedAtAttr = this.__options.underscored ? 'updated_at' : 'updatedAt'
if(this.__options.timestamps && this.hasOwnProperty(updatedAtAttr)) if(this.__options.timestamps && this.hasOwnProperty(updatedAtAttr)) {
this[updatedAtAttr] = new Date() var now = new Date()
this[updatedAtAttr] = now
values[updatedAtAttr] = now
}
if(this.isNewRecord) { if(this.isNewRecord) {
return this.QueryInterface.insert(this, this.__factory.tableName, this.values) return this.QueryInterface.insert(this, this.__factory.tableName, values)
} else { } else {
var identifier = this.__options.hasPrimaryKeys ? this.primaryKeyValues : this.id var identifier = this.__options.hasPrimaryKeys ? this.primaryKeyValues : this.id
, tableName = this.__factory.tableName , tableName = this.__factory.tableName
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!