The problem is that story.user is returning a nil object. When Ruby then looks for the method 'login' on the object returned by story.user it can't find that method - the nil object doesn't have one.
Basically, the error means you don't have a user associated to the story. This could happen because of one of the following:
- No user has been assigned to the story
- The user that was assigned to the story has been deleted or altered in a way that broke the association.
- The code that associates users with with stories is broken.
You could handle the problem by altering line 4 to:
Submitted by: <%= story.user ? story.user.login : 'unknown' -%> |
Alternatively add code to ensure that a user is always associated with a story.