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

Undefined method "full_name"

In Building Rails app > Customizing Forms > Navigation Links video at 2:57, the instructor puts in

<%= link_to current_user.full_name, "#" %>

It works in the video but not for me. I get an error:

undefined method `full_name' for nil:NilClass

2 Answers

When you get a nil:NilClass error, that means that the object, in this case current_user, is nil. So it doesn't have a full_name and the error occurs.

So I created another user. Refreshed. And "ta-da" it works. Awesome. Why? NO IDEA.

This worked for me!