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
Yuichi Hagio
11,367 Points[Code Challenge SOLVED] Building the Friendship UI - Finding and Building Models 3/3
"Create a new UserFriendship instance variable set to user_friendship with the user set to the current_user and the friend set to the @friend instance variable."
I cannot pass this challenge, and it only just says "Bummer! Try again!", I don't know what I'm doing wrong.
my code:
class UserFriendshipsController < ApplicationController
def new
if params[:friend_id]
@friend = User.find(params[:friend_id])
@user_friendship = current_user.user_friendships.new(friend: @friend)
else
flash[:error] = "Friend required"
end
end
end
2 Answers
Marco Carettoni
3,164 PointsHey I had the same problem as you, I also opened a topic then started searching in the history...
I now found the solution
http://teamtreehouse.com/forum/stuck-creating-a-user-friendship-help (look at the first reply from Jason Seifer
Yuichi Hagio
11,367 PointsThank you very much Marco! Now I could pass this :)