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

Commit 19d18ae6 by Sascha Depold

prepare the parameters first

1 parent f8772a82
Showing with 5 additions and 5 deletions
...@@ -97,17 +97,17 @@ module.exports = (function() { ...@@ -97,17 +97,17 @@ module.exports = (function() {
// if an array with field names is passed to save() // if an array with field names is passed to save()
// only those fields will be updated // only those fields will be updated
DAO.prototype.save = function(fieldsOrOptions, options) { DAO.prototype.save = function(fieldsOrOptions, options) {
var self = this
, values = fieldsOrOptions ? {} : this.dataValues
, updatedAtAttr = Utils._.underscoredIf(this.__options.updatedAt, this.__options.underscored)
, createdAtAttr = Utils._.underscoredIf(this.__options.createdAt, this.__options.underscored)
if (fieldsOrOptions instanceof Array) { if (fieldsOrOptions instanceof Array) {
fieldsOrOptions = { fields: fieldsOrOptions } fieldsOrOptions = { fields: fieldsOrOptions }
} }
options = Utils._.extend({}, options, fieldsOrOptions) options = Utils._.extend({}, options, fieldsOrOptions)
var self = this
, values = options.fields ? {} : this.dataValues
, updatedAtAttr = Utils._.underscoredIf(this.__options.updatedAt, this.__options.underscored)
, createdAtAttr = Utils._.underscoredIf(this.__options.createdAt, this.__options.underscored)
if (options.fields) { if (options.fields) {
if (self.__options.timestamps) { if (self.__options.timestamps) {
if (options.fields.indexOf(updatedAtAttr) === -1) { if (options.fields.indexOf(updatedAtAttr) === -1) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!