title: Rails: has_many through with polymorphic association - will this work?
body: <p>A <code>Person</code> can have many <code>Events</code> and each <code>Event</code> can have one polymorphic <code>Eventable</code> record.  How do I specify the relationship between the <code>Person</code> and the <code>Eventable</code> record?</p>
  
  <p>Here are the models I have:</p>
  
  <pre><code>class Event &lt; ActiveRecord::Base
    belongs_to :person
    belongs_to :eventable, :polymorphic =&gt; true
  end
  
  class Meal &lt; ActiveRecord::Base
    has_one :event, :as =&gt; eventable
  end
  
  class Workout &lt; ActiveRecord::Base
    has_one :event, :as =&gt; eventable
  end
  </code></pre>
  
  <p>The main question concerns the <code>Person</code> class:</p>
  
  <pre><code>class Person &lt; ActiveRecord::Base
    has_many :events
    has_many :eventables, :through =&gt; :events  # is this correct???
  end
  </code></pre>
  
  <p>Do I say <code>has_many :eventables, :through =&gt; :events</code> like I did above?</p>
  
  <p>Or do I have to spell them all out like so:</p>
  
  <pre><code>has_many :meals, :through =&gt; :events
  has_many :workouts, :through =&gt; :events
  </code></pre>
  
  <p>If you see an easier way to accomplish what I'm after, I'm all ears! :-)</p>