Minor cleanup

This commit is contained in:
Fabien Franzen 2014-07-26 15:23:40 +02:00
parent 00dfe563eb
commit 9f94ec9bde
2 changed files with 2 additions and 6 deletions

View File

@ -1074,14 +1074,14 @@ RelationDefinition.hasAndBelongsToMany = function hasAndBelongsToMany(modelFrom,
options.polymorphic = params.polymorphic;
var accessor = params.through.prototype[params.polymorphic];
if (typeof accessor !== 'function') { // declare once
params.through.belongsTo(modelTo);
params.through.belongsTo(params.polymorphic, { polymorphic: true });
}
} else {
params.through.belongsTo(modelFrom);
params.through.belongsTo(modelTo);
}
params.through.belongsTo(modelTo);
this.hasMany(modelFrom, modelTo, options);
};

View File

@ -161,7 +161,3 @@ RelationMixin.hasAndBelongsToMany = function hasAndBelongsToMany(modelTo, params
RelationMixin.hasOne = function hasMany(modelTo, params) {
RelationDefinition.hasOne(this, modelTo, params);
};
RelationMixin.belongsToPolymorphic = function belongsToPolymorphic(polymorphic, params) {
RelationDefinition.belongsToPolymorphic(this, polymorphic, params);
};