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.
Build a Simple Ruby on Rails Application-Creating Relationships
Hi, I need help about Creating Relationships. When i follow the introduction on this part, i add has_many :statuses and belongs_to :user to each model, and finished the view part. However, when i run server it comes out "undefined method `first_name' for nil:NilClass" in show.html.erb file also the same problem in index file. I already used the Status.delete_all in console. it still don't work. Please advise
OK, I fixed it.
How did you fix this??!!
Yeah I am having that same problem, for me, when I go into my console and run User.all I see that my first_name, last_name, and profile_name have not been set (they are just nil). So I tried to delete the user and re-register but again I end up with nil for those three fields, maybe that has something to do with it and is a similar problem to what you're having