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.

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?