assuming that you have a object named ‘story’ in your DB, you need to check your story controller and check if there is a appropriate method to call that object.
The error indicate that @story is currently a nil object. The nil Object is of the class NilClass, and this doesn’t have a names method.
The reason you are getting this is because @story is not being loaded with a Story object elsewhere in your code. For example: because @story is not being assigned in your controller. This may be because the code that assigns it is absent, or is not working as you expect.
For example, there should be something like this in the controller:
Just in case someone else comes across this, I had the same error. My solution may help you.
The instruction on p212 confused me (the code example is actually an excerpt). My mistake was to replace all the code instead of appending it. Try checking app/models/story.rb has the following code…
class Story < ActiveRecord::Base
validates_presence_of :name, :link
has_many :votes
def to_param
"#{id}-#{name.gsub(/\\W/, '-').downcase}"
end
end