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

Commit b0c7a448 by Mick Hansen

Remove dao value rebuilding (should no longer be needed after earlier getter/setter refactor)

1 parent 3afdc41e
Showing with 1 additions and 15 deletions
...@@ -563,20 +563,6 @@ module.exports = (function() { ...@@ -563,20 +563,6 @@ module.exports = (function() {
this.addAttribute(key, attrs[key]) this.addAttribute(key, attrs[key])
} }
} }
// this.addAttributes COMPLETELY destroys the structure of our DAO due to __defineGetter__ resetting the object
// so now we have to rebuild for bulkInserts, bulkUpdates, etc.
var rebuild = {}
// Get the correct map....
Utils._.each(this.attributes, function(key) {
if (this.dataValues.hasOwnProperty(key)) {
rebuild[key] = this.dataValues[key]
}
}.bind(this))
// This allows for aliases, etc.
this.dataValues = Utils._.extend(rebuild, this.dataValues)
} }
return DAO return DAO
......
...@@ -1080,7 +1080,7 @@ describe(Support.getTestDialectTeaser("DAO"), function () { ...@@ -1080,7 +1080,7 @@ describe(Support.getTestDialectTeaser("DAO"), function () {
it('returns a response that can be stringified', function(done) { it('returns a response that can be stringified', function(done) {
var user = this.User.build({ username: 'test.user', age: 99, isAdmin: true }) var user = this.User.build({ username: 'test.user', age: 99, isAdmin: true })
expect(JSON.stringify(user)).to.deep.equal('{"username":"test.user","age":99,"isAdmin":true,"id":null}') expect(JSON.stringify(user)).to.deep.equal('{"id":null,"username":"test.user","age":99,"isAdmin":true}')
done() done()
}) })
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!