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
I cannot load my main page in the treebook project with Ruby on Rails. I keep getting this error. Not sure what I am doing wrong here.
undefined method `full_name' for nil:NilClass Extracted source (around line #9): 6: 7: <% @statuses.each do |status|%> 8: <div class="status"> 9: <strong><%= status.user.full_name %></strong> 10: <p><%= status.content%></p> 11: <div class"meta"> 12: <%= link_to time_ago_in_words(status.created_at) + " ago", status %>
Jason SeiferTreehouse Guest Teacher
Try following along with Jim in this video and let us know if you still have trouble:
I have recently taken this entire video set and ran into this as well. If you follow the video step-for-step you will run into this, and for me it was a matter of dropping the old database and starting fresh.
In the video Jim suggested deleting certain status post, then editing the remaining posts with a user, otherwise you would get a different error as well.
Took me a few days to figure out, but finally got <%= status.user.full_name %> to work.
Try starting with deleting all users, and all statuses, in rails console. In the rails console type: (user = User.all) then: (user.delete_all) then: (status = Status.all) and lastly: (status.delete_all)
Go back to the app, create a new profile and post a new status. You should see your full name displaying correctly.
You may also need to add a few devise parameter sanitizers to your Application Controller. You should be able to find those answers in the forum if necessary.
Hope this helps!