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

You need to sign in or sign up before continuing.
Commit 2a3cf738 by Sascha Depold

minor formatting

1 parent 12970d17
Showing with 6 additions and 10 deletions
......@@ -89,29 +89,25 @@ module.exports = (function() {
, updatedAtAttr = this.__options.underscored ? 'updated_at' : 'updatedAt'
, createdAtAttr = this.__options.underscored ? 'created_at' : 'createdAt'
if(fields) {
if(self.__options.timestamps) {
if(fields.indexOf(updatedAtAttr) === -1) {
if (fields) {
if (self.__options.timestamps) {
if (fields.indexOf(updatedAtAttr) === -1) {
fields.push(updatedAtAttr)
}
if(fields.indexOf(createdAtAttr) === -1) {
if (fields.indexOf(createdAtAttr) === -1) {
fields.push(createdAtAttr)
}
}
fields.forEach(function(field) {
if(self.values[field] !== undefined) {
if (self.values[field] !== undefined) {
values[field] = self.values[field]
}
})
}
if(this.__options.timestamps && this.hasOwnProperty(updatedAtAttr)) {
var now = new Date()
this[updatedAtAttr] = now
values[updatedAtAttr] = now
this[updatedAtAttr] = values[updatedAtAttr] = new Date()
}
if(this.isNewRecord) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!