Need help with join / edit

Hi i have a issue here:
Model: COMPANY
Model: USER
JOIN-MODEL: user_company

in the index view of the user i would like to have a second row per each
user to insert a index / vire partial from the User-Company-Join
relation:

user/index:

Listing Users

<% for u in @users %>

<% end %>
Firstname Lastname Username
<%=h u.firstname + u.id.to_s %> <%=h u.lastname %> <%=h u.username %> <%= link_to 'Show', u %>
<%=h render :partial =>'user_companies/edit', :local => @users %>


user_company controller:
def edit
@user_company = UserCompany.find(params[:id])
end

user_companies / edit :

Editing user_division

<% form_for(@user_company) do |f| %>
<%= f.error_messages %>

Record ID:
<%= @user_comp.id %>

<%= f.submit "Update" %>

<% end %> --------------------------------------------------- its givin me : Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id all the time... please guys give me a hint...thx

Just at a glance it looks like you should change @user_comp to
@user_company in user_companies/edit.

And as a tip if you don’t have any additional fields to keep track of
in your user_company model, you should use a has_and_belongs_to_many
relationship.

-J.

hi, mh ur right, but still it complains about the variable im using in
the partial…
partial:

<% form_for(@users.companies) do |f| %>

undefined method `companies’ for #Array:0xb6c106a4

what i wanna achivee is the join table between user and company. the rb’s are ok.

thx tom