Welcome to the Treehouse Community
Looking to learn something new?
undefined method `full_name during Navigation links tutorial
I no longer need this answered, I figured it out, my session expired in the app so there was no current user defined.
Following the instructions in the Navigation Links tutorial I have added the following code as instructed in the tutorial to my application.html.erb file:
<div class="navbar fixed-top"> <div class="navbar-inner"> <div class="container"> <a href="#" class="brand">Treebook</a> <ul class="nav"> <li><%= link_to "All statuses", statuses_path %></li> </ul> <ul class="nav pull-right"> <li><%= link_to current_user.full_name, "#" %></li> </ul> </div> </div> </div>
After saving and refreshing the page, I get a undefined method 'full_name' error, user.full_name works everywhere else in the application, but I can't seem to figure out why it is not working for this page. I hate to move on the tutorial without knowing what I am doing wrong. Anyone have any insight?
Wilson Usman35,206 Points
Daniel, first I would launch your rails console and verify that all users have a first name and last name defined. If they don't, you can delete the user, or define the first and last names.
This is why I was getting the same error. Let me know if this helps.