backbone-relations
Advanced tools
Comparing version 0.4.6 to 0.4.7
@@ -36,7 +36,10 @@ (function () { | ||
if (!this.via) return this.get(); | ||
var models = this.owner.resolve(this.via).pluck(this.viaKey); | ||
var via = this.owner.relations[this.via]; | ||
var method = via.hasOne ? 'get' : 'pluck'; | ||
var resolved = this.owner.resolve(this.via)[method](this.viaKey); | ||
if (this.hasOne) return resolved; | ||
return new this.hasMany( | ||
models[0] instanceof this.hasMany ? | ||
_.flatten(_.pluck(models, 'models')) : | ||
models | ||
resolved[0] instanceof this.hasMany ? | ||
_.flatten(_.pluck(resolved, 'models')) : | ||
resolved | ||
); | ||
@@ -43,0 +46,0 @@ } |
{ | ||
"name": "backbone-relations", | ||
"version": "0.4.6", | ||
"version": "0.4.7", | ||
"main": "./backbone-relations.js", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
{ | ||
"name": "backbone-relations", | ||
"version": "0.4.6", | ||
"version": "0.4.7", | ||
"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
34219
9
147