adding HABTM association while creating a record

Hello Experts,
I have a HABTM association as followed:

class Account < ActiveRecord::Base
  has_and_belongs_to_many :user
end

class User < ActiveRecord::Base
  has_and_belongs_to_many :type
  has_and_belongs_to_many :account
end

class Type < ActiveRecord::Base
  has_and_belongs_to_many :user
end

I have the following query;
I Have a parent user who is creating another user under its account.
How can i add association record between the new user (that is getting
added) and the parent user's account.
my form is as followed:

  <div class="field">
    <%= f.label :username %><br />
    <%= f.text_field :username %>
  </div>
  <div class="field">
    <%= f.label :email %><br />
    <%= f.text_field :email %>
  </div>
  <div class="field">
    <%= f.label :password %><br />
    <%= f.password_field :password %>
  </div>
  <div class="field">
    <%= f.label :password_confirmation %><br />
    <%= f.password_field :password_confirmation %>
  </div>

   <% for type in Type.find(:all) %>
    <div>
      <%= check_box_tag "user[type_ids][]", type.id,
@user.type.include?(type) %>
      <%= type.type_name %>
    </div>
  <% end %>

  <div class="actions">
    <%= f.submit %>
  </div>

Thanks in advance for any guidelines.