title: Rails: Why "has_many ..., :through => ..." association results in "NameError: uninitialized constant ..."
body: <p>To express that a group can have multiple users, and a user can belong to multiple groups, I set the following associations:</p>
  
  <pre><code>class Group &lt; ActiveRecord::Base
    has_many :users_groups
    has_many :users, :through =&gt; :users_groups
  end
  
  class User &lt; ActiveRecord::Base
    has_many :users_groups
    has_many :groups, :through =&gt; :users_groups
  end
  
  class UsersGroups &lt; ActiveRecord::Base
    belongs_to :user
    belongs_to :group
  end
  </code></pre>
  
  <p>However, when I type:</p>
  
  <pre><code>Group.find(1).users
  </code></pre>
  
  <p>I get:</p>
  
  <pre><code>NameError: uninitialized constant Group::UsersGroup
  </code></pre>
  
  <p>What am I doing wrong ?</p>