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 trialJustin Whedon
19,811 Points'undefined method `title' for nil:NilClass' Error
I'm getting this error... but everything was working fine up until this point.
In 'Rails Routes & Resources: Creating a View'.
undefined method `title' for nil:NilClass Extracted source (around line #1): 1 <h1><%= @page.title %></h1> 2 3 4 <p><%= @page.body %></p>
3 Answers
Lee Vaughn
Treehouse TeacherThanks!
Not sure if this is the only issue since I am not able to run your code but at least part of the issue is that you have a small syntax difference in your show method (page
rather than Page
). Try fixing that and see what happens.
Justin Whedon
19,811 PointsBAM!! That was 100% the problem. Not sure how I missed that :/
Thank you so much Lee!!!
Lee Vaughn
Treehouse TeacherBeen there done that Justin! Those little things often seem to be the hardest to spot.
Glad to have helped and happy coding!
Lee Vaughn
Treehouse TeacherHi Justin Whedon!
Which video are you currently working on/having trouble with? In your post, you mention the "Creating a View" lesson but in that video all Jay does is add an H1 header in the index.html.erb template. You have more code than that in your screenshots so I am not quite sure where you are in the course and where you started running into problems.
Also, can you share a link to a GitHub repo or a Snapshot of your Workspace so that we can see, test, and troubleshoot the code first hand?
Thanks!
Justin Whedon
19,811 PointsJustin Whedon
19,811 PointsI cannot move forward on my Ruby Track until I get this figured out. Anyone?