has_many through

I have a User model defined as following :
  has_many :memberships, :class_name => 'Member', :include => [ :group ]
  has_many :members, :dependent => :delete_all
  has_many :groups, :through => :memberships

and a Group model
  has_many :members, :include => :user
  has_many :users, :through => :members

finally the Member model
  belongs_to :user
  belongs_to :hub

given a group @group , a user @user,and a member @member
how do create the association ?

thanks for your help

erwin

[...]

given a group @group , a user @user,and a member @member
how do create the association ?

@member.user = @user
@group.members << @member

thanks for your help

erwin

Best,