backbone-relations
Advanced tools
Comparing version 0.4.1 to 0.4.2
@@ -49,3 +49,2 @@ (function () { | ||
owner.set(fk, model.id, options); | ||
if (reverse) model.get(reverse).add(owner, options); | ||
}); | ||
@@ -55,2 +54,12 @@ owner.on('change:' + fk, function (__, val, options) { | ||
}); | ||
if (reverse) { | ||
instance.on({ | ||
add: function (model, __, options) { | ||
model.get(reverse).add(owner, options); | ||
}, | ||
remove: function (model, __, options) { | ||
model.get(reverse).remove(owner, options); | ||
} | ||
}); | ||
} | ||
return instance; | ||
@@ -86,3 +95,4 @@ }, | ||
if (!this.via) return instance; | ||
var models = instance.via.pluck(this.via.split('#')[1] || this.key); | ||
var split = this.via.split('#'); | ||
var models = this.owner.get(split[0]).pluck(split[1] || this.key); | ||
return instance.set( | ||
@@ -89,0 +99,0 @@ models[0] instanceof this.hasMany ? |
{ | ||
"name": "backbone-relations", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"author": "Casey Foster <c@sey.me>", | ||
@@ -5,0 +5,0 @@ "licence": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6633
132