Skip to content

Commit

Permalink
differentiate between normal defaultValues and NOW
Browse files Browse the repository at this point in the history
  • Loading branch information
sdepold committed May 1, 2012
1 parent 8921b13 commit 473bce0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/dao-factory.js
Expand Up @@ -165,7 +165,7 @@ module.exports = (function() {
var value = null

if(self.rawAttributes.hasOwnProperty(name) && self.rawAttributes[name].hasOwnProperty('defaultValue')) {
value = self.rawAttributes[name].defaultValue
value = Utils.toDefaultValue(self.rawAttributes[name].defaultValue)
}

instance[name] = value
Expand Down
5 changes: 3 additions & 2 deletions lib/dao.js
Expand Up @@ -249,8 +249,9 @@ module.exports = (function() {
}

Utils._.map(defaults, function(value, attr) {
if(!self.hasOwnProperty(attr))
self.addAttribute(attr, value)
if(!self.hasOwnProperty(attr)) {
self.addAttribute(attr, Utils.toDefaultValue(value))
}
})
}

Expand Down
3 changes: 2 additions & 1 deletion lib/data-types.js
Expand Up @@ -4,5 +4,6 @@ module.exports = {
INTEGER: 'INTEGER',
DATE: 'DATETIME',
BOOLEAN: 'TINYINT(1)',
FLOAT: 'FLOAT'
FLOAT: 'FLOAT',
NOW: 'NOW'
}

0 comments on commit 473bce0

Please sign in to comment.