I’m getting an undefined method error and I’m not sure why.

I'm a newb with Rails, so bear with me. I'm getting an error that states:
undefined method `comments' for #
Did you mean? committed!

Then the extracted source shows:

Comments

<% @article.comments.each do |comment| %>

Commenter:
<%= comment.commenter %>

I'm not sure what is needed to help me find the problem, so please be patient and I will get what is needed.

2 thoughts on “I’m getting an undefined method error and I’m not sure why.”

  1. Well the error is:

    undefined method `comments’

    and the place you call .comments is at

    @article.comments.each

    so my guess would be that @article isn’t what you think it is or doesn’t have access yo what you think it does. You’ll have to track that down somehow.

    Reply

Leave a Comment