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\":\"test01-J0of1frlU80@public.gmane.org\", \"role\":\"2\", \"name\": \"name01\", \"password\":\"passwd\"}}" http://127.0.0.1:3000/users 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. Thanks -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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. HTH John On 9 August 2011 18:09, Pete <ghar-ZQk49NHuUFDi/gmLfIWLuQ@public.gmane.org> wrote:> 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\":\"test01-J0of1frlU80@public.gmane.org\", \"role\":\"2\", \"name\": > \"name01\", \"password\":\"passwd\"}}" http://127.0.0.1:3000/users > > 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. > > Thanks > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Sweet! that worked Thank you very much On Aug 9, 10:48 am, John Winters <jhwint...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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. > > HTH > John > > On 9 August 2011 18:09, Pete <g...-ZQk49NHuUFDi/gmLfIWLuQ@public.gmane.org> wrote: > > > > > > > > > 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\":\"tes...-J0of1frlU80@public.gmane.org\", \"role\":\"2\", \"name\": > > \"name01\", \"password\":\"passwd\"}}"http://127.0.0.1:3000/users > > > 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. > > > Thanks > > > -- > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To unsubscribe from this group, send email to > > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > For more options, visit this group at > >http://groups.google.com/group/rubyonrails-talk?hl=en.-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.