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

Commit 82719d59 by Sascha Depold

first steps for better private method scoping

1 parent 12fd2280
Showing with 3 additions and 2 deletions
......@@ -115,12 +115,13 @@ ModelFactory.prototype.find = function(options) {
}
ModelFactory.prototype.build = function(values, options) {
var instance = new Model(values, Utils._.extend(this.options, {hasPrimaryKeys: this.hasPrimaryKeys}))
var instance = new Model(values, Utils._.extend(this.options, this.attributes, { hasPrimaryKeys: this.hasPrimaryKeys }))
, self = this
options = options || {}
instance.__definition = this
//console.log(this.attributes)
Utils._.map(this.attributes, function(definition, name) {
if(typeof instance[name] == 'undefined') {
var value = null
......@@ -129,7 +130,7 @@ ModelFactory.prototype.build = function(values, options) {
value = self.rawAttributes[name].defaultValue
instance[name] = value
instance.addAttribute(name, value)
instance.__addAttribute(name, value)
}
})
Utils._.each(this.options.instanceMethods || {}, function(fct, name) { instance[name] = fct })
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!