backbone-relations
Advanced tools
Comparing version 0.8.0 to 0.8.1
@@ -174,5 +174,4 @@ (function (root, factory) { | ||
this.prototype.relations = relations; | ||
var check = _.first(_.values(relations)); | ||
if (_.isFunction(check.hasOne || check.hasMany)) return; | ||
_.each(relations, function (rel) { | ||
if (_.isFunction(rel.hasOne || rel.hasMany)) return; | ||
if (rel.hasOne) rel.hasOne = rel.hasOne.Model; | ||
@@ -182,6 +181,8 @@ if (rel.hasMany) rel.hasMany = rel.hasMany.Collection; | ||
if (rel.via || !fk) return; | ||
var Model = rel.hasOne || rel.hasMany.prototype.model; | ||
var complement = Model.prototype.relations; | ||
var complement = rel.hasOne || rel.hasMany.prototype.model; | ||
if (!(complement.prototype instanceof Model)) return; | ||
complement.resolveRelations(); | ||
var reverseRels = complement.prototype.relations; | ||
var hasOne = !rel.hasOne; | ||
rel.reverse = _.reduce(complement, function (reverse, rel, key) { | ||
rel.reverse = _.reduce(reverseRels, function (reverse, rel, key) { | ||
if (!rel.via && hasOne !== !rel.hasOne && fk === rel.fk) return key; | ||
@@ -188,0 +189,0 @@ return reverse; |
{ | ||
"name": "backbone-relations", | ||
"version": "0.8.0", | ||
"version": "0.8.1", | ||
"main": "./backbone-relations.js", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
{ | ||
"name": "backbone-relations", | ||
"version": "0.8.0", | ||
"version": "0.8.1", | ||
"author": "Casey Foster <c@sey.me>", | ||
@@ -5,0 +5,0 @@ "licence": "MIT", |
Sorry, the diff of this file is not supported yet
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
36704
189