title: Validation failed: User can't be blank
body: <p>All,</p>
  
  <p>I am getting the error:  <em>Validation failed: User can't be blank</em>.  I am getting this error when I save down a comment. Can anyone point me in the right direction possibly? </p>
  
  <p><strong>The comments controller</strong></p>
  
  <pre><code>class CommentsController &lt; ApplicationController
  def create
  @topic = Topic.find(params[:topic_id])
  @post = @topic.posts.find(params[:post_id])
  @comment = @post.comments.new(params.require(:comment).permit(:body))
  
  @comment.save!#save the code down in the database
  
  redirect_to [@topic, @post]
  end
  end
  </code></pre>
  
  <p><strong>Comment model</strong></p>
  
  <pre><code>  class Comment &lt; ActiveRecord::Base
    belongs_to :post
    belongs_to :user
  
    validates :body, length: { minimum: 5 }, presence: true
    validates :user_id, presence: true
    end
  </code></pre>
  
  <p><strong>Error on page when saving down to the database</strong>
  <img src="https://i.stack.imgur.com/f4rpJ.jpg" alt="comment"></p>