Usually end up replying to my own threads :)
Should probably mention that I started with active_rbac (modified by
now).
I found a workaround though:
customer.users.delete(user)
customer.users << user
=Reverse it. Something apparently is up with the user model. I have an
instance of the user model in the session (not with the customers
loaded), but I do a User.find on this one, since it is part of an
admin piece.
Fredrik
On Feb 28, 10:40 am, "Fredrik"
<fredrik.thures...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hi,
>
> 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.
>
> My error:
> Customer expected, got Customer
>
> Caused by:
> @user = User.find(params[:id])
> customer = Customer.find(params[:customer_id])
>
> @user.customers.delete(customer) #This statement
> and
> @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.
>
> Thanks,
>
> Fredrik
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---