I’ve seen a few threads here about HABTM raising
AssociationTypeMissmatch exceptions, but no definate answer.
I’m having this problem with one of my relationships and cannot figure
out what is causing it. The other threads implies that it is something
in my code, and I must say I agree that it is likely, but I have 200+
controllers and <300 models, so this is quite an interesting task even
though the majority can be ruled out.
Customer expected, got Customer
@user = User.find(params[:id])
customer = Customer.find(params[:customer_id])
@user.customers.delete(customer) #This statement
@user.customers << customer #This statement.
Actually, the second one worked once in the middle of my testing which
makes it even worse, but just once.