When i execute the command to appear the column of user when have the many comments this error:
<% post.comments.each do |comment| %>
<div id="comments" >
<%= comment.user.email if comment.user.email != nil %>
<%= comment.comment %>
</div>
NoMethodError in Posts#index
Showing /Users/overallduka/Blog1/app/views/posts/index.html.erb where line #50 raised:
undefined method `email' for nil:NilClass
Extracted source (around line #50):
The comments model have belongs_to user and the user model have has_many comments, as right this, but i dont identifie the problem, i check and all my comments have user_id , please some solution please.