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 trialJahveed Shirzad
Courses Plus Student 284 PointsI keep getting a NoMethodError when trying to display the users name next to status.
NoMethodError in Statuses#show
Showing /Users/jahveedshirzad/projects/piknic/app/views/statuses/show.html.erb where line #5 raised:
undefined method `first_name' for nil:NilClass Extracted source (around line #5):
2: 3: <p> 4: <b>Name:</b> 5: <%= @status.user.first_name %> 6: </p> 7: 8: <p>
2 Answers
Maciej Czuchnowski
36,441 PointsThis suggests that when this status was created, it did not get any user assigned to it. Which version of Rails are you using? You can see the version of Rails in your Gemfile. If it only says gem 'rails', without specifying any version number, please check the Gemfile.lock. If the version number is not 3.2 or lower, we probably have our culprit and I may be able to guide you through this.
Jahveed Shirzad
Courses Plus Student 284 PointsThank You, installed the version of ruby on rails that is used in the videos and am running fine now.
Once again thank you :)