niezdefiniowana metoda `email 'dla nil: NilClass w Exibe poczta tabeli Ojciec

Mam problem, robię ten atribbuition i komentuję model:

class Comment < ActiveRecord::Base
  attr_accessible :comment
  belongs_to :post
  belongs_to :user

i to w modelu użytkownika

class User < ActiveRecord::Base
  attr_accessible :email, :password, :password_confirmation
  has_many :posts
  has_many :comments

ale to nie działa:

  <% post.comments.each do |comment|   %>
    <div id="comments" >
      <%= comment.user.email %>
           <%= comment.comment %>
    </div>
   <%end%>

pojawia się błąd:

undefined method `email' for nil:NilClass

proszę, jaki jest problem, w tworzeniu komentarza robię tak atribbuition, spójrz:

  @comment = @post.comments.create(params[:comment],:user_id => current_user.id)

jak rozwiązać ten błąd, proszę-

AKTUALIZUJ NASTĘPNE ODPOWIEDZI, BŁĄD OKRESU:

Próbuję tego:

@comment = Comment.new(params[:comment])
@comment.user = current_user
@comment.post = @post
@comment.save

to

@comment = @post.comments.create(params[:comment].merge(:user_id => current_user.id))

i to:

@comment = @post.comments.build(params[:comment])
@comment.user = current_user
@comment.save

nie działa

ten sam błąd:

undefined method `email' for nil:NilClass
Extracted source (around line #48):

45: 
46:       <% post.comments.each do |comment|   %>
47:         <div id="comments" >
48:           <%= comment.user.email %>
49:                <%= comment.comment %>
50:         </div>
51:        <%end%>

Nie wiem, co jest nie tak, mój komentarz modelu ma: user_id

  attr_accessible :comment,:user_id,:post_id

a moja forma jest taka

   <div id="comment_form_<%= post.id %>" style="display: none;" >

      <%= form_for [post,post.comments.build], :remote => true,:class=>"comment" do |com| %>
          <%= com.text_area :comment %>
          <%= com.submit "aaa" %>

      <%end %>

proszę mi pomóc, nie wiem, gdzie jest błąd, db jest poprawnie migrowany

questionAnswers(3)

yourAnswerToTheQuestion