title: Rails - multiple associations to same model
body: <p>I'm building a Rails app to track expenses/debts among members of a group, let's say a household. So far I have models for Groups, Users and Expenses - the basics. Right now I'm trying to figure out the associations between Groups and Users. For example, a Group can have many users and a user can have/belong to many groups, so I set a HABTM association using a join table. But I'm confused because a Group can also have one owner, which is also a User. This is where I am right now:</p>
  
  <pre><code>class Group &lt; ActiveRecord::Base
      has_and_belongs_to_many :users
      has_one :owner, :class_name =&gt; "User"
  end
  
  class User &lt; ActiveRecord::Base
      has_and_belongs_to_many :groups
  end
  </code></pre>
  
  <p>There's currently an owner_id field on the Group table, but I'm getting a PostgreSQL Error <code>column users.group_id does not exist</code> when I try and do anything involving <code>group.owner</code>. I'm fairly lost - any ideas on the best way to represent multiple associations to the same model here?</p>