Merge pull request #189 from strongloop/feature/include-target-for-hasOne
relation: add `scope._target` for `hasOne` (1.x, 2.x)
This commit is contained in:
commit
c92575c292
|
@ -1055,6 +1055,7 @@ RelationDefinition.hasOne = function (modelFrom, modelTo, params) {
|
|||
var relationMethod = relation.related.bind(relation)
|
||||
relationMethod.create = relation.create.bind(relation);
|
||||
relationMethod.build = relation.build.bind(relation);
|
||||
relationMethod._targetClass = relationDef.modelTo.modelName;
|
||||
return relationMethod;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -658,6 +658,9 @@ describe('relations', function () {
|
|||
});
|
||||
});
|
||||
|
||||
it('should set targetClass on scope property', function() {
|
||||
should.equal(Supplier.prototype.account._targetClass, 'Account');
|
||||
});
|
||||
});
|
||||
|
||||
describe('hasAndBelongsToMany', function () {
|
||||
|
|
Loading…
Reference in New Issue