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

Commit 78113233 by Mick Hansen

use the proper key

1 parent 65e36f7b
Showing with 6 additions and 7 deletions
...@@ -147,16 +147,15 @@ module.exports = (function() { ...@@ -147,16 +147,15 @@ module.exports = (function() {
var opt = type + 'terMethods' var opt = type + 'terMethods'
, funcs = Utils._.isObject(self.options[opt]) ? self.options[opt] : {} , funcs = Utils._.isObject(self.options[opt]) ? self.options[opt] : {}
Utils._.each(self.rawAttributes, function(options, attribute) {
Utils._.each(self.rawAttributes, function(attribute, name) { if (options.hasOwnProperty(type)) {
if (attribute.hasOwnProperty(type)) { funcs[attribute] = options[type]
funcs[name] = attribute[type] } else if (typeof funcs[attribute] === "undefined") {
} else if (typeof funcs[name] === "undefined") {
if (type === 'get') { if (type === 'get') {
funcs[name] = function() { return this.dataValues[attribute]; } funcs[attribute] = function() { return this.dataValues[attribute]; }
} }
if (type === 'set') { if (type === 'set') {
funcs[name] = function(value) { funcs[attribute] = function(value) {
if (Utils.hasChanged(this.dataValues[attribute], value)) { if (Utils.hasChanged(this.dataValues[attribute], value)) {
//Only dirty the object if the change is not due to id, touchedAt, createdAt or updatedAt being initiated //Only dirty the object if the change is not due to id, touchedAt, createdAt or updatedAt being initiated
var updatedAtAttr = Utils._.underscoredIf(this.__options.updatedAt, this.__options.underscored) var updatedAtAttr = Utils._.underscoredIf(this.__options.updatedAt, this.__options.underscored)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!