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

Navigation Links: undefined method `full_name' for nil:NilClass

Hi, I just started with basic Rails app yesterday, I'm stucked in the Navigation Links part of Costumizing Form. I've been following up the videos step by step, I re-watch them all (untill this part) twice.

At min 3:03 when Jim adds the link using "current_user.full_name" is where I get this error.

undefined method `full_name' for nil:NilClass

Extracted source (around line #19):

16:           <li><%= link_to "All Statuses", statuses_path %></li>
17:         </ul>
18:         <ul class="nav pull-right">
19:           <li><%= link_to current_user.full_name, edit_user_registration_path %></li>
20:         </ul>
21:       </div>
22:     </div>

Edit 1: It's fixed. I really didn't do anything, I went to sleep, then start to work on the project again, run the rails server and voila!

Edit 2: Using Chrome it runs like a charm, no error. But I started this project using Firefox's Nightly (Just to live on the edge as a "Pro Dev") and this is where the error occours.

Any way to fix this? or I just continue the develpment on Chrome?

1 Answer

Wilson Usman
Wilson Usman
35,206 Points

Daniel I had a similar error, what was causing this error was that there were users with no first name, or last name defined or both, I deleted those Users and it worked.

Now my issue is that I don't see the links for some reason.

Are you using Rails 3.X.X or 4.0?