backbone-relations
Advanced tools
Comparing version 0.8.5 to 0.8.6
@@ -40,7 +40,8 @@ (function (root, factory) { | ||
if (!this.via) return this.get(); | ||
var via = this.owner.relations[this.via]; | ||
var owner = this.owner; | ||
var via = owner.relations[this.via]; | ||
var method = via.hasOne ? 'get' : 'pluck'; | ||
var resolved = this.owner.resolve(this.via)[method](this.viaKey); | ||
var resolved = owner.resolve(this.via)[method](this.viaKey); | ||
if (this.hasOne) return resolved; | ||
return new this.hasMany( | ||
resolved = new this.hasMany( | ||
resolved[0] instanceof this.hasMany ? | ||
@@ -50,2 +51,7 @@ _.flatten(_.pluck(resolved, 'models')) : | ||
); | ||
resolved.urlRoot = this.urlRoot || '/' + this.key; | ||
resolved.url = this.url || function () { | ||
return _.result(owner, 'url') + this.urlRoot; | ||
}; | ||
return resolved; | ||
}, | ||
@@ -52,0 +58,0 @@ |
{ | ||
"name": "backbone-relations", | ||
"version": "0.8.5", | ||
"version": "0.8.6", | ||
"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
8721
185