Chapter 7 Undefined method 'name' error
Hi guys, I am a newbie and have run into a wall in Chapter 7, Ajax and Web 2.0.
I am trying to display the page based on ID number, for example by loading http://localhost:3000/stories/2
However, I keep getting the error:
NoMethodError in Stories#show
undefined method `name' for nil:NilClass
Extracted source (around line #1):
1: <h2><%= @story.name %></h2>
2: <p><%= link_to @story.link, @story.link %></p>
I have been trying to find a solution on Google to no avail. I thought it might have to do with no values for 'name' being passed correctly or some problem with the routes. I tried playing around with both, but have not been able to find a solution.
Any help is greatly appreciated.