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

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