ActiveRecord::AssociationTypeMismatch


#1

I have 2 models:

mop, has_and_belong_to_many :contacts
contact, has_and_belong_to_many :mops

when I save my mop Ii have the users coming in a an array:
[“9”,10"]

I am doing this to asscociate each one to a mop:

@contacts.each do |contact|
@mop.contacts << contact
end

Contact(#44950470) expected, got String(#20837400)

It is giving me the above error. Any ideas?


#2

Never mind. I looked at Ryan B. complex forms example for the
100th time and got it to work using his method. SWEET.