Forum: Ruby on Rails HABTM Relation / Save Question

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.
A7db9ec803b5895ae5f916a74e2db329?d=identicon&s=25 HH (Guest)
on 2006-03-04 23:15
(Received via mailing list)
Ok, so I have two models that HABTM each other.

Companies
UserAccounts

When creating a new user account, this works:

@company.user_accounts << @user

This works with or without a subsequent save of @company.

And the association is set properly but this does nothing (fails
silently):

@user.companies << @company

This fails both when I do and don't save @user afterwards.

I've checked all around and none of the objects are nil.

Strange! Am I doing something wrong? It seems like both should work
equally
well.

Hunter
This topic is locked and can not be replied to.