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 trialBenedict Allen
3,907 PointsNoMethodError in Statuses#show
After entering content for new status + user ID into the user ID field an error is displayed upon clicking enter.
undefined method `full_name' for nil:NilClass
<b>Name:</b> <%= @status.user.full_name %>
What could be causing this? I thought I'd followed the tutorial to the letter
1 Answer
Raymond Wach
7,961 PointsThis kind of error message typically happens when you have code along the lines of:
puts myVariable.full_name
But it turns out that myVariable
is unassigned and consequently has the value nil
. Look at the object you are calling full_name
on and make sure that it is getting assigned properly.