title: Rails has_many :through Find by Extra Attributes in Join Model
body: <p>New to both Ruby and Rails but I'm book educated by now (which apparently means nothing, haha).</p>
  
  <p>I've got two models, Event and User joined through a table EventUser</p>
  
  <pre><code>class User &lt; ActiveRecord::Base
    has_many :event_users
    has_many :events, :through =&gt; :event_users
  end
  
  class EventUser &lt; ActiveRecord::Base
    belongs_to :event
    belongs_to :user
  
    #For clarity's sake, EventUser also has a boolean column "active", among others
  end
  
  class Event &lt; ActiveRecord::Base
    has_many :event_users
    has_many :users, :through =&gt; :event_users
  end
  </code></pre>
  
  <p>This project is a calendar, in which I have to keep track of people signing up and scratching their name out for a given event. I figure the many to many is a good approach, but I can't do something like this:</p>
  
  <pre><code>u = User.find :first
  active_events = u.events.find_by_active(true)
  </code></pre>
  
  <p>Because events don't actually HAVE that extra data, the EventUser model does.  And while I could do:</p>
  
  <pre><code>u = User.find :first
  active_events = []
  u.event_users.find_by_active(true).do |eu|
    active_events &lt;&lt; eu.event
  end
  </code></pre>
  
  <p>This seems to be contrary to "the rails way".  Can anyone enlighten me, this has been bugging me for a long time tonight (this morning)?</p>