On 4 March 2010 10:29, Neil Bye <[email protected]> wrote:
>
> You have a nil object when you didn't expect it!
> The error occurred while evaluating nil.login
>
> Extracted source (around line #2):
>
> 1: <p id="story"><%= comment.content %></p>
> 2: <p>Submitted by:<%=comment.user.login %></p>
>

You're being told that you have a nil object on line 2 when evaluating
the "login" method. So "user" is nil - and I'd guess we'd expect it to
be a User object...
I can't see anywhere in the controller (CommentController I assume)
that assigns a user to a comment, so that's a good place for you to
start.
Make sure somewhere does something along the lines of "comment.user =
current_user"... even hard-code comment.user_id to a known value to
check that when there *is* a user on the comment, the view displays
correctly. Then you can go back and make sure the comment is being
built properly.

Hope this helps.
Michael

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to