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

Friendship form promblem

I've been stuck with this problem for quite some time now, I've gone over the video probably 6 times now to now luck... I get the same error message of

test: #new when logged in should display the friend's name. (UserFriendshipControllerTest): ActionView::Template::Error: undefined method `user_friendships_path' for #<#<Class:0x00000101220478>:0x000001013fc210>

In the web-browser the message is displayed as:

NoMethodError in User_friendship#new

Showing /Users/Andre/Documents/RubyProject/treebook/app/views/user_friendship/new.html.erb where line #5 raised:

undefined method `model_name' for NilClass:Class Extracted source (around line #5):

2: <h1><%= @friend.full_name %></h1> 3:
4: <p>Do you really want to friend <%= @friend.full_name %>?</p> 5: <%= form_for @user_friendship, method: :post do |form| %> 6: <div class="form form-actions"> 7: <%= form.hidden_field :friend_id, value: @friend %> 8: <%= submit_tag "Yes, Add Friend", class: 'btn btn-primary' %>

Rails.root: /Users/Andre/Documents/RubyProject/treebook

Application Trace | Framework Trace | Full Trace app/views/user_friendship/new.html.erb:5:in `app_views_user_friendship_new_html_erb__4322220514339960689_2157975680' Request

Parameters:

{"friend_id"=>"@epicdre"} Show session dump

Show env dump

Response

Headers:

None

Not sure what to do...

1 Answer

Jason Seifer
STAFF
Jason Seifer
Treehouse Guest Teacher

Hey Andre Hitchman can you paste the output of the following command:

bundle exec rake routes