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
Jim Shook
4,871 PointsRedirect to the profile_path of the friend.
My code in the 3rd code challenge doesn't seem to be passing and I'm not sure how to have it pass.
Here is what I have:
class UserFriendshipsController < ApplicationController
def create
@user_friendship = UserFriendship.new(params[:user_friendship])
if @user_friendship.save
flash[:success] = "Friendship created."
redirect_to profile_path(@friend)
else
flash[:error] = "There was a problem."
redirect_to root_path
end
end
end
3 Answers
Jason Seifer
Treehouse Guest TeacherHey Jim Shook your code is correct. There's a small issue with the code challenge engine which is being worked on now. Sorry about that!
Jason Seifer
Treehouse Guest TeacherThis should be working now. Just a heads-up, Jim Shook you can put the redirect at the end of the if/else block and remove the redirect_to root_path if there was an error. That will make the code challenge pass.
Micah Goldston
5,014 PointsSeems like something is up with the engine again? Can't get else flash[:error] = "There was a problem." redirect_to root_path end end end
to pass the final step.
Micah Goldston
5,014 PointsNevermind. got it to pass w/ redirect_to profile_path(@friend).
Jim Shook
4,871 PointsCool thanks Jason :)
Carrie Gildersleeve
9,609 PointsCarrie Gildersleeve
9,609 PointsIs this still being worked on? I am having the same issue...