Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

AssociationTypeMismatch

Hey guys

I'm following the RoR treebook course (be it with a slight variation for my own app idea) and I've run into the following error when trying to add to pending_user_friendships

When I run the test, it fails with test_that_creating_a_user_friendship_based_on_user_id_and_friend_id_works(UserFriendshipTest): ActiveRecord::AssociationTypeMismatch: User(#2171142120) expected, got Fixnum(#2151921940)`

I've copied the code from the sample project in both controller, model and test and am still getting the same error.

Thanks for your help!

Fixed it, you can close this one :)

1 Answer

Way to solve your own problem Jan!