Skip to content

Commit

Permalink
Fixes reversed hasOne.getAccessor when called without callback (#267)
Browse files Browse the repository at this point in the history
Returns a ChainFind which can then be filtered..
  • Loading branch information
dresende committed Oct 30, 2013
1 parent b7e8985 commit dd67c7c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/Associations/One.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ function extendInstance(Model, Instance, Driver, association) {

if (association.reversed) {
if (util.hasValues(Instance, Model.id)) {
if (typeof cb !== "function") {
return association.model.find(util.getConditions(Model, Object.keys(association.field), Instance), opts);
}
association.model.find(util.getConditions(Model, Object.keys(association.field), Instance), opts, saveAndReturn);
} else {
cb(null);
Expand Down

0 comments on commit dd67c7c

Please sign in to comment.