code: function addForeignValidator(fieldValidator, relation, _ignoreCallback) {
      let relObj = this.model(relation.name, true),
        relPrimary = relObj.getPrimary(),
        relName = relation.options.foreignKey.name;
      if (relPrimary) {
        addValidator(fieldValidator, relName, relPrimary);
      }
      fieldValidator[relName].fieldName = relName;
      if (relation.options.foreignKey.allowNull) {
        fieldValidator[relName].default(null);
      }
      if (_ignoreCallback === true) return fieldValidator[relName];
      // query the model when an incoming request containing the id comes.
      fieldValidator[relName].callback((val, done) => {
        if (val == null) return done();
        if (typeof val === 'object' && typeof val.get === 'function') return done(null, val); // it was previously queried and fetched.
        let RelModel = this.model(relation.name);
        let where = {};
        if (typeof val === 'function') val = val();
        where[relPrimary.fieldName] = val;
        RelModel.find({
          where: where,
          attributes: [relPrimary.fieldName]  // we just check for existance.
        }).then((rObj) => {
          if (!rObj) {
            return done(thorin.error('INPUT.NOT_VALID', 'Invalid reference for ' + relName, 404));
          }
          done(null, rObj.get(relPrimary.fieldName));  //return with the id
        }).catch((e) => {
          done(thorin.error(e));
        });
      });
      return fieldValidator[relName];
    }
docs: /* Attaches a foreign validator to the input