Question about has_many :through association

Hi,

I have two models called Group and User. A group shall have a leader and
several members, whereas leader and members are of type User.

I am using the following associations:

class Group < ActiveRecord::Base
has_one :group_leader, :class_name => ‘User’
has_many :group_members, :through => :group_leader
end

class User < ActiveRecord::Base
belongs_to :group
has_many :group_members, :class_name => “User”, :foreign_key =>
“group_leader_id”
belongs_to :group_leader, :class_name => “User”
end

And also put the following into a migration
add_column :users, :group_id, :integer
add_column :users, :group_leader_id, :integer

Then I assign a group leader to a group and a member to a leader. When I
do a

Group.find(:first).group_members I get the following exception:

ActiveRecord::StatementInvalid: Mysql::Error: Not unique table/alias:
‘users’: SELECT users.* FROM users INNER JOIN users ON
users.group_leader_id = users.id WHERE ((users.group_id = 8))

What is that all about? Any help is highly appreciated. Thank you!

Cheers,
Tobi