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
Adam Carter
3,108 PointsMissing Attributes error, Rails Treebook project
Hey all! I'm new to Rails and have been following every step of the Rails Treebook classes on here...every time I click on "add friend", I get this error in the localhost browser: can't write unknown attribute `friend_id', and it says the error is in user_friendships_controller.rb...I have my code looking exactly the same as in the videos, I've triple checked...here is more code that the error spits out from that controller...any help, I would greatly appreciate it!
@friend = User.where(profile_name: params[:friend_id]).first
raise ActiveRecord::RecordNotFound if @friend.nil?
@user_friendship = current_user.user_friendships.new(friend: @friend)
else
flash[:error] = "Friend required"
end
Jason Seifer et all, let me know if you need to see more code! I've been googling this for hours and can't seem to figure it out...
1 Answer
Jason Seifer
Treehouse Guest TeacherHey Adam Carter can you paste a link to your project code? We need just a bit more information to troubleshoot. Thanks!