Modeling 2 relationships between 2 entites

Hello,
I've got the following quiet common domain model.

http://55degrees.co.uk/ewan/peopleUserGroups.pdf

As you can see a person can create 0 or many groups, a group being
created by 1 person. A person belongs to 1 or many groups and a group
can contain many people. A can also contain many sub groups.

A simple person class to describe these relationship would be...

class Person < ActiveRecord::Base
  #relationships
  has_many :usergroups
  has_and_belongs_to_many :usergroups
end

obviously this is wrong I can't name both usergroups 'usergroups'. How
do I rename the relationship so I can refer to the two relationships.
Cheers,
Ewan

Hello,
I've got the following quiet common domain model.

http://55degrees.co.uk/ewan/peopleUserGroups.pdf

As you can see a person can create 0 or many groups, a group being
created by 1 person. A person belongs to 1 or many groups and a group
can contain many people. A can also contain many sub groups.

A simple person class to describe these relationship would be...

class Person < ActiveRecord::Base
#relationships
has_many :usergroups
has_and_belongs_to_many :usergroups
end

class Person
   has_many :created_groups, :class_name => 'Usergroup', :foreign_key
=> 'person_id'
   has_and_belongs_to_many :usergroups
end
should do the trick

Fred

Thank you both for your reply and thanks for not just telling me to
RTFM. Having just started using Ruby and Rails it's appreciated having
people how are willing to help with the simple questions.
Cheers,
Ewan

http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html#M001079