lib/relations/belongs_to.js
function(instance) {
    var self = this;
    var result = Promise.bind();
    var fk = instance.getAttribute(this.foreignKeyAttr);
    if (fk) {
      result = result.then(function() {
        return self.objectsQuery(instance).execute();
      })
      .then(function(result) {
        self.validateFetchedObjects(instance, result);
        return result[0];
      });
    }
    else {
      result = result.then(function() {
        // pretend like we actually did the whole fetch & got back nothing
        self.associateFetchedObjects(instance, [null]);
      });
    }
    return result;
  }
function(instance) {
    var self = this;
    var result = Promise.bind();
    var fk = instance.getAttribute(this.foreignKeyAttr);
    if (fk) {
      result = result.then(function() {
        return self.objectsQuery(instance).execute();
      })
      .then(function(result) {
        self.validateFetchedObjects(instance, result);
        return result[0];
      });
    }
    else {
      result = result.then(function() {
        // pretend like we actually did the whole fetch & got back nothing
        self.associateFetchedObjects(instance, [null]);
      });
    }
    return result;
  }
function ( instance ) { var self = this ; var result = Promise . bind ( ) ; var fk = instance . getAttribute ( this . foreignKeyAttr ) ; if ( fk ) { result = result . then ( function ( ) { return self . objectsQuery ( instance ) . execute ( ) ; } ) . then ( function ( result ) { self . validateFetchedObjects ( instance , result ) ; return result [ 0 ] ; } ) ; } else { result = result . then ( function ( ) { // pretend like we actually did the whole fetch & got back nothing self . associateFetchedObjects ( instance , [ null ] ) ; } ) ; } return result ; }
Fetch the related object. If there is no foreign key defined on the
instance, this method will not actually query the database.

@method
@protected
@param {Model} instance The model instance on which to operate.
@see {@link BaseRelation#methods}
Fetch the related object . If there is no foreign key defined on the instance this method will not actually query the database .