Devise AssociationTypeMismatch

My site is using Devise and Cancan. Currently I have 3 roles setup I am testing creating a new user using the following command (role is required):

curl -H "Content-Type:application/json" -H "Accept:application/json" - d "{\"user\":{\"email\":\"\", \"role\":\"2\", \"name\": \"name01\", \"password\":\"passwd\"}}"

and get the following error:

ActiveRecord::AssociationTypeMismatch in RegistrationsController#create Role(#70259472646000) expected, got String(#70259436671420)

I also tried using \"role\":\"member\"

I think the problem is how I am passing in the role, but I am unsure what else to try.


Try passing "role_id":"2".

I started seeing this in my tests as soon as I updated to 3.1rc5. It didn’t happen with 3.1rc4.



Sweet! that worked Thank you very much