title: Sequelize Getting model object from relations
body: <p>When I define a relation, I specify what model object it is related to:</p>
  
  <pre><code> models.Guest.belongsTo(models.Member, {foreignKey: 'guestId', as: 'guest'});
  </code></pre>
  
  <p>Now to use this relationship in a query, I need to specify the model object again:</p>
  
  <pre><code> Guest.findAll({
      include: models.Member,
      as: 'guest'
   });
  </code></pre>
  
  <p>In my setup, all the relationships are defined in a single file, while individual models are in files by themselves.  The setup defines the models object, which has all of them - and the thing is available to application logic.</p>
  
  <p>What I would like is define some of the more complex queries directly in the Guest model object, to abstract them away from the application. To do this, I'd like to find the models.Member object - retrieving it somewhere out of the relationship:</p>
  
  <pre><code>Guest.findMembers = function(){
    return this.findAll({
       include: &lt;that model that guest is related to&gt;,
       as: 'guest'
    });
  }
  </code></pre>
  
  <p>Please imagine that the example is complex enough that it warrants solving.  Lots more other joins and where statements, for instance. Or data processing after the fact.</p>
  
  <p>I can pass the models object into the setup of each individual object, so its siblings can be accessed. Is that my only option?</p>