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 trialAdam Kelm
29,082 PointsNoMethodError: undefined method 'accepted_user_friendships'
Right after Jason pastes in all the index tests late in the Blocking UI lesson, then runs user_friendships_controller_test.rb, all his tests pass. But I'm not having any luck with them.
I get an error of " 1) Error: test: #index when logged in accepted friendships should display requested friends. (UserFriendshipsControllerTest): NoMethodError: undefined method `accepted_user_friendships' for #<User:0x5ea93d0>" no matter what I do. I have even downloaded the project files and copy/pasted the entire controller test and controller, but I get the same error. Does anyone know what's going on here?
2 Answers
Adam Kelm
29,082 PointsAnd as soon as I post this, I dig in and figure it out. I forgot to add the has_ many :accepted_user_friendships in the user model. Stupid mistake!
Yoochan Seo
305 PointsAdam Kelm Thanks for your answer :D