Merge pull request #195 from lchenay/patch-3

Fix HEAD on relation hasMany
This commit is contained in:
Raymond Feng 2014-07-28 08:53:46 -07:00
commit 5cc2c5d92f
1 changed files with 3 additions and 0 deletions

View File

@ -397,6 +397,9 @@ RelationDefinition.hasMany = function hasMany(modelFrom, modelTo, params) {
var updateByIdFunc = scopeMethods.updateById;
modelFrom.prototype['__updateById__' + relationName] = updateByIdFunc;
var existsByIdFunc = scopeMethods.exists;
modelFrom.prototype['__exists__' + relationName] = existsByIdFunc;
if(definition.modelThrough) {
scopeMethods.create = scopeMethod(definition, 'create');
scopeMethods.add = scopeMethod(definition, 'add');