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

having trouble with treebook "saving models and redirecting" code challenge

Q: Set the flash success message to "Friendship created" if the @user_friendship is saved.

I must not be understanding it correctly but I know that flash[:success] = "Friendship created" is the setting part but checking if the @user_friendship was saved does not seem to be working no matter what I have tried.

4 Answers

Hi Daniel,

There's a bug in this code challenge. See my comment on this post for details on how to complete the challenge.

http://teamtreehouse.com/forum/creating-friendship-ui-form#show-comment-588

Jason Seifer
STAFF
Jason Seifer
Treehouse Guest Teacher

Sorry about the bug in the code challenge, everyone. We'll look in to it. Thanks Matt for the help!

Make sure to add the period in the flash message.

This did NOT work

@user_friendship = UserFriendship.new(params[:user_friendship])
  if @user_friendship.save
      flash[:success] = "Friendship created"
  end

This did work

@user_friendship = UserFriendship.new(params[:user_friendship])
  if @user_friendship.save
      flash[:success] = "Friendship created."
end

Is the missing period on purpose? because I had no idea I was suppose to be looking out for it.. since it's displayed as a string and I couldn't tell because the right side keeps displaying mocha deprecation warnings. Was that because of the challenge?

well i was having some issues with chrome in general, turned off most extensions i use for work, been smooth now.