title: multiple has_many / belongs_to between the same 2 models
body: <p>I'm curious how this works... I have several has_many relationships between the same two models.  This is for a calendaring app, so a User can be invited to an Event, a User can attend an Event, and an Event belongs to a User for purposes of seeing who created the event.</p>
  
  <p><strong>user.rb</strong></p>
  
  <pre><code>class User &lt; ActiveRecord::Base
    has_many :invites, dependent: :destroy
    has_many :events, through: :invites
  
    has_many :events
  
    has_many :attendances, -&gt; { where cancel: false },
                           dependent: :destroy                     
    has_many :events, -&gt; { where "attendances.cancel" =&gt; false },
                      through: :attendances
  </code></pre>
  
  <p><strong>event.rb</strong></p>
  
  <pre><code>class Event &lt; ActiveRecord::Base
    has_many :invites, dependent: :destroy
    has_many :users, through: :invites
  
    belongs_to :user
  
    has_many :attendances, -&gt; { where cancel: false },
                           dependent: :destroy              
    has_many :users, -&gt; { where "attendances.cancel" =&gt; false },
                     through: :attendances
  </code></pre>
  
  <p>I also have the corresponding join tables, controlled in their respective models, <code>attendance.rb</code>, and <code>invite.rb</code>.</p>
  
  <p>So... this works as expected.  A User has Events when they're attending the Event.  I did some tweaking, and realized it was the last thing in the list that was checked.  So, if I move the invites to the bottom, then that's what's checked when I do something like <code>User.find(1).events</code>.</p>
  
  <p>Is there a better way to go about this?  I feel like this is just asking for trouble, no?</p>