title: Activerecord: Cannot get :through => to work
body: <p>I'm working on a project in which people organize gaming sessions. The (abridged) Model is as follows.</p>
  
  <pre><code>class User &lt; ActiveRecord::Base
    has_many :events, dependent: :destroy      #events organized by user
    has_many :reservations, dependent: :destroy
  end
  
  class Event &lt; ActiveRecord::Base
    belongs_to :user
    has_many :reservations, dependent: :destroy
  end
  
  class Reservation &lt; ActiveRecord::Base
    belongs_to :events
    belongs_to :users
  end
  </code></pre>
  
  <p>In this way, when I use <code>@user.events</code> I get, as expected, a list of the event the user organizes. </p>
  
  <p>But I wanted a list of the events that the User has a reservation to, (using something like <code>@user.reserved_events</code>, so I added this to the User model:</p>
  
  <pre><code>has_many :reserved_events, :class_name =&gt; 'Event',:through =&gt; reservations
  </code></pre>
  
  <p>This broke everything, and I got a mysterious</p>
  
  <pre><code>undefined local variable or method `reservations' for #&lt;Class:0x00000003681048&gt;
  </code></pre>
  
  <p><em><strong>EDIT</em></strong></p>
  
  <p>Thanks to Christopher Manning, I changed <code>reservations</code> to <code>:reservations</code>, thus eliminating the trivial error. However, if I now try to use <code>@user.reserved_events</code> o <code>@user.reservations.count</code>, i get </p>
  
  <pre><code>Could not find the source association(s) :reserved_event or :reserved_events in model Reservation. Try 'has_many :reserved_events, :through =&gt; :reservations, :source =&gt; &lt;name&gt;'. Is it one of :events or :users?
  </code></pre>
  
  <p>Complying to the request leads me nowhere: if I use <code>:source =&gt; :users</code>, I get</p>
  
  <pre><code>SQLite3::SQLException: no such column: reservations.users_id: SELECT COUNT(*) FROM "events" INNER JOIN "reservations" ON "events"."id" = "reservations"."users_id" WHERE "reservations"."user_id" = 1
  </code></pre>
  
  <p>using <code>:source =&gt; :events</code> makes it balk at a different missing column</p>
  
  <p>My temporary solution is to use direct SQL: </p>
  
  <p><code>@reserved_events = Event.find_by_sql("select events.* from events,reservations where events.id=reservations.event_id AND reservations.user_id="+@user.id.to_s)</code></p>
  
  <p>Better ideas?</p>