Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
undefined method 'full name' for nil:NilClass
i'm getting this error when i go to /statuses.
I added a 'before_filter :authenticate_user!' on my StatusesController
what happens is that i need to login before i can view my status.
how do i make it work so that i can view different statuses from other users even when logged out? if i remove the 'before_filter' i get 'undefined method `full_name' for nil:NilClass' error
Hey Joanthan it's likely you have created a status that is not associated with a user. So when you try to call
on one of your statuses it errors out.
If you don't mind deleting your local data try this in your terminal.
This will allow you to interact with your application from the command line.
This will give you a listing of all the statuses you have in your local db, then do-
This will delete all the Statuses in your local db, now you should be able to access /statuses in your browser but there will not be any because you just deleted them from the command line. So try creating a new status and be sure to associate it with a User otherwise you will get the same error.
Alternatively, just as a check that this is the problem, you could (temporarily) remove the line
<%=link_to status.user.full_name, profile_path(status.user) %>
from your app/views/status/index.html.erb file and you should be able to access the page in your browser. If this is in fact the cause of the error. It might be good to do this first before deleting test user data.