Merge pull request #225 from fabien/fix/has-many-exists

HasMany exists should use internal findById
This commit is contained in:
Raymond Feng 2014-08-16 08:11:49 -07:00
commit 9777639cb4
1 changed files with 1 additions and 2 deletions

View File

@ -692,12 +692,11 @@ HasMany.prototype.findById = function (fkId, cb) {
* @param {Function} cb The callback function
*/
HasMany.prototype.exists = function (fkId, cb) {
var modelTo = this.definition.modelTo;
var fk = this.definition.keyTo;
var pk = this.definition.keyFrom;
var modelInstance = this.modelInstance;
modelTo.findById(fkId, function (err, inst) {
this.findById(fkId, function (err, inst) {
if (err) {
return cb(err);
}