How to create text_field for has_many form

Hello

2 solid days of time and I can’t figure this/find answer in previous
group post/find answer via google anything that works. I know the
problem is me (and I will know doubt kick myself later) but if anyone
could direct me I’d appreciate it.

I have items (called ‘WeeeItems’) in one place that need to be
delivered somewhere else. When they get delivered we need a ‘transfer
note’, (called ‘WeeeTransfer’). So, I need to create a new transfer
note recording the destination,date etc and select items from a list
of existing stock that are included with that transfer.

I’ve got forms and things working to add items into the
‘WeeeItems’ (our stock waiting to transfer), but I can’t figure how to
include given weeeitems with a specific transfer. Trying to keep
things as simple as possible while I figure what I’ve got wrong
(normally helps!) I’m finding I don’t know how to refer to the
weee_items_id of the related table. As such, the view detailed below
will NOT add anything to the transfer table failing with:

NoMethodError in WeeeController#confirmtransfer
You have a nil object when you didn’t expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.save

So, I think this means I need a form field that references 1 or more
WeeeItems, I just don’t know how to do that. I thought along the
lines of
f.text_field :weeeitemsid
but that and variations haven’t worked so far.

Any direction greatly appreciated.

Thanks,
Steve

Model

class WeeeTransfer < ActiveRecord::Base
has_many :weee_items
#belongs_to is in the other model
end

Controller

def confirmtransfer
@transfer = WeeeTransfer.new(params[:transfer])
if request.post? and @weeetype.save
flash[:notice] = ‘WEEE Transfer added’
redirect_to :action => ‘index’
end
end

#this bit will get us all the UNtransfered weee items
#i will eventually use this to have list of check boxes for items

included in the transfer
#but it’s not used yet… is that my problem?
@tableweees = WeeeItem.find(:all, :include => “weee_type”,
:conditions => “weee_transfers_id is null”)

View

WEEE Items

<% form_for :transfer do |f| %>
Weee Destination: <%= f.text_field :weeetransferdestination %><br /
Transfer Type: <%= f.text_field :weeetransfertype %><br />
Transfer Date:  <%= f.text_field :weeetransferdate  %><br />
  <%= submit_tag %>

<% end %>

you could add a hidden tag in there with the id of the weeItem