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

Commit e68552f5 by Daniel Durante

Whoops, reversed the logic tests should pass now.

1 parent b073729c
Showing with 7 additions and 5 deletions
...@@ -219,11 +219,12 @@ module.exports = (function() { ...@@ -219,11 +219,12 @@ module.exports = (function() {
var readOnlyAttributes = Object.keys(this.__factory.primaryKeys) var readOnlyAttributes = Object.keys(this.__factory.primaryKeys)
readOnlyAttributes.push('id') readOnlyAttributes.push('id')
if (this.isNewRecord === true) {
readOnlyAttributes.push('createdAt') if (this.isNewRecord !== true) {
readOnlyAttributes.push(this.daoFactory.options.underscored === true ? 'created_at' : 'createdAt')
} }
readOnlyAttributes.push('updatedAt') readOnlyAttributes.push(this.daoFactory.options.underscored === true ? 'updated_at' : 'updatedAt')
readOnlyAttributes.push('deletedAt') readOnlyAttributes.push(this.daoFactory.options.underscored === true ? 'deleted_at' : 'deletedAt')
Utils._.each(updates, function(value, attr) { Utils._.each(updates, function(value, attr) {
var updateAllowed = ( var updateAllowed = (
...@@ -231,6 +232,7 @@ module.exports = (function() { ...@@ -231,6 +232,7 @@ module.exports = (function() {
(readOnlyAttributes.indexOf(Utils._.underscored(attr)) == -1) && (readOnlyAttributes.indexOf(Utils._.underscored(attr)) == -1) &&
(self.attributes.indexOf(attr) > -1) (self.attributes.indexOf(attr) > -1)
) )
updateAllowed && (self[attr] = value) updateAllowed && (self[attr] = value)
}) })
} }
......
...@@ -992,7 +992,7 @@ describe(Support.getTestDialectTeaser("DAO"), function () { ...@@ -992,7 +992,7 @@ describe(Support.getTestDialectTeaser("DAO"), function () {
createdAt: new Date(2000, 1, 1), createdAt: new Date(2000, 1, 1),
identifier: 'another identifier' identifier: 'another identifier'
}).success(function(user) { }).success(function(user) {
expect((new Date(user.createdAt)).getTime()).to.equal((new Date(oldCreatedAt)).getTime()) expect(new Date(user.createdAt)).to.equalDate(new Date(oldCreatedAt))
expect(user.identifier).to.equal(oldIdentifier) expect(user.identifier).to.equal(oldIdentifier)
done() done()
}) })
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!