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!
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

Dongju Seo
2,339 Pointsundefined method `full_name' for nil:NilClass
while I was following this tutorial, 'Creating Relationships', I encountered with this error. status.rb and user.rb with all of html.erb files are the same with the project files included in the tutorial. I cannot figure out where the cause of error is located in..!
10 Answers

Justin Johnson
Courses Plus Student 24,793 Pointsrails console then Status.delete_all worked !

Nicholas Fox
5,520 PointsI was stumped by the same error for a while. I kept clearing all statuses and users from the database using the rails console, then generating a new user and new statuses. I still would receive this same error message.
The issue was I was providing an incorrect user_id.
When you "sign up" for the site, look in the command prompt window and find the message associated with adding a new user to the database (you may have to scroll up). Near the end of that message, it will tell you the user_id associated with that user. Try plugging that in when writing a status. That fixed the problem for me!

Pratik Agarwal
3,457 PointsThanks! This one fixed it for me too! I was posting the status under id 1 (as per the tutorial video), when in actual reality my id was 4. Great advice!

Ryan Carson
23,287 PointsCan you please show us the error you got?

Dongju Seo
2,339 PointsI apologize for the absence of the error display...
NoMethodError in Statuses#index
Showing c:/Projects/treebook/app/views/statuses/index.html.erb where line #10 raised:
undefined method `full_name' for nil:NilClass Extracted source (around line #10):
7: 8: <% @statuses.each do |status| %> 9: <div class="status"> 10: <strong><%= status.user.full_name %></strong> 11: <p><%= status.content %></p> 12: <div class="meta"> 13: <%= link_to time_ago_in_words(status.created_at) + " ago", status %> Rails.root: c:/Projects/treebook
Application Trace | Framework Trace | Full Trace
app/views/statuses/index.html.erb:10:in block in _app_views_statuses_index_html_erb___1060382079_28817352'
app/views/statuses/index.html.erb:8:in
each'
app/views/statuses/index.html.erb:8:in _app_views_statuses_index_html_erb___1060382079_28817352'
app/controllers/statuses_controller.rb:7:in
index'
Request
Parameters:
None

Justin Johnson
Courses Plus Student 24,793 PointsI'm stuck on the exact same problem, any suggestions would be great :) thanks

Dongju Seo
2,339 PointsI fixed this problem!

Shawn Miller
3,688 Pointshow?? :/ I'm having the exact same thing.

Jerome Johnson
6,716 PointsI' m receiving this same error and its frustrating me to no end!! I believe I'm getting it because I don't have a value set for the "first_name" or "last_name" variables. How can I set a value to get rid of the error??

Shawn Miller
3,688 PointsI'm having the same issue... any fixes??

mario pochat
1,106 Pointswow, same error here. An explanation on how to fix it would be obviously great.

markuslopez
371 Pointsdid you ever get a response? having the same issue!

Michael Leonard
866 PointsIm having the same issue as well. Clearing all data in the rails console does not fix the problem.

markuslopez
371 Pointsdid you ever get a response? having the same issue!

steven zern
3,518 PointsI;m having the same issue and have tried everything i can find anywhere HELP PLEASE!!!

markuslopez
371 Pointsdid you ever get a response? having the same issue!

Indrek Vainu
548 PointsI had the problem that this line
<li><%= link_to current_user.full_name, "#" %></li>
in my layouts/application.html.erb caused a undefined method error.
what helped was that I deleted all my users and statuses from the database. I used DB Browser for SQLite program for that, simple to use and the graphical interface for me at least gives a better overview .
After deleting all the statuses and users, I added a new user via sign_up and a new status and then this line
<li><%= link_to current_user.full_name, "#" %></li>
did not give any errors and my full name was displayed top right as the name of the person currently logged in.