HABTM Relation / Save Question


#1

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