Forum: Ruby on Rails ActiveRecord::AssociationTypeMismatch

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Chris H. (Guest)
on 2009-02-23 08:34
(Received via mailing list)
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?
Chris H. (Guest)
on 2009-02-23 09:17
(Received via mailing list)
Never mind.  I looked at Ryan B. complex forms example for the
100th time and got it to work using his method. SWEET.
This topic is locked and can not be replied to.