lib/assets/javascripts/backbone_extensions/associations.js in backbone_extensions-0.0.19 vs lib/assets/javascripts/backbone_extensions/associations.js in backbone_extensions-0.0.20

- old
+ new

@@ -10,11 +10,11 @@ mergeOptions: function() { return _(arguments).chain().toArray().reduce(function(result, options) { return _(result).extend(options); }, {}) .omit('class', 'className', 'inverseOf', 'parseName', 'through').value(); }, - buildAssociation: function(associationType, associationName, options) { + buildAssociation: function(namespace, associationType, associationName, options) { function through() { function association() { var t = (_(options.through).isFunction() && options.through.call(this)) || _.str.camelize(options.through); return this[t] && this[t]() && this[t]()[associationName] && this[t]()[associationName](); } @@ -130,11 +130,11 @@ belongsTo: {}, hasMany: {parse: true}, hasOne: {parse: true} }).reduce(function(associations, defaultOptions, associationType) { associations[associationType] = function(name, options) { var associationName = _.str.camelize(name); options = _({}).extend(defaultOptions, globalOptions, options); - fn.buildAssociation.call(this, associationType, associationName, options); + fn.buildAssociation.call(this, namespace, associationType, associationName, options); fn.parseAssociation.call(this, associationType, associationName, options); return this; }; return associations; }, {}); @@ -160,10 +160,10 @@ }); }) }); source.prototype.initialize = _(source.prototype.initialize).wrap(function(oldInitialize, attrsOrModels, options) { - this._options = _(options).clone(); + this._options = this._options || _(options).clone(); oldInitialize.call(this, attrsOrModels, options); }); } }; }